Loqate Harmony Documentation
  • GBG Loqate AU & NZ
  • Loqate Harmony API
    • Sign up for free trial
    • Login
    • API Specification
      • Authentication
      • Address
        • Address Validation & Lookup
        • Address by Geocode
        • Address Cleanse
        • Address Parse
        • Geocode Intl
      • Address Insights
        • Australian Insights
          • SEIFA Australia
          • ASGS Australia Statistical Geography Standard
          • Residential / Commercial
          • Deliverable address
      • Suburb Lookup
      • Business Validation and Lookup
      • Email Validation
      • Phone Validation
      • Matching
      • Moved Suppression
      • Deceased Suppression
      • Objects
        • Address Objects
        • Address Type Objects
        • Suburb Objects
        • Parse Objects
        • Email Objects
        • Phone Objects
        • Property Title Objects
        • Match Objects
        • Business Objects
      • Deprecated API services
        • Email Validation v1.1
        • Address v1
        • Address Cleanse v1
        • Address International
        • Address Combined
        • Address Types
    • Guides
      • Best Practices
        • Address Field Mappings
        • Finding an Address
      • User Derived Address
      • Expanded sub-premise reach
      • Parcel Locker Plus
      • Migrating to Address V2
      • Sign up/ Login
      • Support
      • Console
        • Getting your API keys
        • Getting Started
        • Add a Service
        • Dashboard
        • Subscriptions
          • Features
          • Users
          • Subscribed Plans
          • Allowlisting domains
          • Blocklist - Email Validation
        • Reports
        • Invoices
          • Paying Invoices
      • API Latency
    • Demos
      • How to use our demos
      • Address Validation Demo
      • Address by Geocode (Reverse Geocode) Demo
      • Address Cleanse Demo
      • Address Parse Demo
      • Business Validation Demo
      • Email Validation Demo
      • Phone Validation demo
    • Integrations
      • Client Libraries
        • Javascript Library v2.1.0
      • Adobe Commerce (Magento 2) Plugin
        • Magento2 User Guide
      • Woocommerce Plugin
        • Woocommerce Install Guide v2.0.0
        • Woocommerce Settings guide v2.0.0
      • Shopify Plus App
      • Gravity Forms
      • Voxco Survey Software
      • Salesforce CRM
      • Dynamics 365 CRM
      • Batch App - Lightweight
      • Deprecated Integrations
        • Harmony RightAddress c# example
        • Harmony RightAddress cURL example
        • Deprecated JS Library v2.0.1
        • Deprecated JQuery Library v1.8.1
    • Coverage
    • Address Exchange (Beta)
      • ADX Console
        • Searching Addresses in console
        • Create Address in console
        • Create Actions in console
      • ADX API Specification
        • Create Address
        • Get Address
        • Create Address Event
        • Edit Address Event
        • Create/Edit Address Attributes
        • Create/Edit Address Geopoint
        • Get Source Events
      • Reserved Attributes
    • GBG Status
  • Batch / Bulk Data Services
    • Serviced Batch
      • Bulk Address Cleanse
      • Email Serviced Batch
      • Phone Serviced Batch
      • Business Serviced Batch
  • Harmony Suite
    • Harmony Suite Overview
    • Release Notes
      • Version 3.0.0
        • New Features
        • Enhancements
        • Bug Fixes
        • Supported Platforms
    • User Guides
      • Version 3.0.0
        • Welcome to Harmony Suite
        • Glossary of terms
        • Upgrades
          • HSQL Upgrade
        • Email and Phone Validation
          • Prerequisites
          • Phone and Email PDP Configuration Setup
          • Phone Validation using Harmony Batch System
          • Phone Validation using Harmony WS
          • Email Validation using Harmony Batch
          • Email Validation using Harmony WS
          • Guides
            • Understanding Phone Data
            • Understanding Email Data
        • Business Lookup and Validation
          • Prerequisites
          • Business Lookup
          • Business Validation
            • Business Validation using Commercial Name Parser
            • Business Validation Configurations
            • Business Validation using Harmony Batch System
            • Business Validation using Harmony WS
          • Business data update guide
          • Guides
            • Understanding Business Data
            • Understanding Business Verification Code
            • Name Parse Ambiguity
        • Australia Post Parcel Locker Plus Lookup and Validation
          • Prerequisites
          • Australia Post Parcel Locker Plus Lookup
          • Australia Post Parcel Locker Plus Validation
            • PDP Configuration Setup
            • AupostValidation using Harmony Batch System
            • AupostValidation using Harmony WS
          • Guides
            • Knowledgebase Lexical Update
            • Understanding Australia Post Parcel Locker Plus Data
            • Interchangeable terms for Australia Post Parcel Lockers
        • Installation and Upgrade Reference Guide
        • Locate Reference Guide
        • Extensions Reference Guide
        • RealTime Reference Guide
        • Postmaster Reference Guide
        • Rapid Address ANZ Reference Guide
        • Post ANZ Reference Guide
        • Source of Truth Installation Reference Guide
        • Knowledgebase Configuration Reference Guide
        • Web Services Reference Guide
        • Management Console Reference Guide
        • Batch System Match Reference Guide
        • Batch System Cleanse Reference Guide
  • More from GBG
    • GBG GreenID
    • GBG Identity
    • GBG Fraud & Compliance
Powered by GitBook
On this page
  • Prerequisites
  • Enabling Address, Phone and Email verification in Gravity Forms
  • Set-up API Key and the above sample code in Gravity Forms
  • Testing your Installation
  • Configuration of requests
  1. Loqate Harmony API
  2. Integrations

Gravity Forms

Gravity Forms is a powerful form-building plugin for WordPress that allows you to create complex forms with ease. Utilise Gravity Forms to enhance your workflows with real-time address verification.

PreviousShopify Plus AppNextVoxco Survey Software

Last updated 8 months ago

Our plugin standardises and verifies AU, NZ and international addresses, email and phone in real-time using the below code.


Prerequisites

  1. Have Wordpress platform and Gravity Forms plugin installed or available oncloud.

  2. Have an active Loqate Harmony API Account. You can sign-up for .

Enabling Address, Phone and Email verification in Gravity Forms

Here is the actual working demo and actual code used. You can use this as a reference. You just need to supply the user and credential in the code.

Just copy the below code to your HTML Block component.


<link rel="stylesheet" type="text/css" href="https://common.mastersoftgroup.com/scripts/harmony-2.1.0.min.css">
<script src="https://common.mastersoftgroup.com/scripts/harmony-2.5.0.min.js" type="text/javascript"></script>

<fieldset>
        <label for="Line1">Address Search</label>
        <div class="dropdown">
            <input id="Line1" type="text" placeholder="Start typing your address" autocomplete="off" autofocus style="width: 500px; box-sizing: border-box;" />
            <div id="addressDropdown" class="dropdown-content" style="width: 300px;"></div>
        </div>
</fieldset>

<script>

  function setupLoqate(){

    let al = null;

    Harmony.useEnv('https://hosted.mastersoftgroup.com'); 
    Harmony.useProtocol(Harmony.CORS);
    Harmony.init(<user>,<credential>, Harmony.AUSTRALIA);

    var featureOptions = { exposeAttributes: "1"};

    Harmony.useFeatureOptions(featureOptions);

    var opt = {
    // optional, min 3 chars to trigger the lookup
    minLength: 3,
    //optional, number of candidates to return from search, default is 20
    hits: 20,
    //optional, case type for the output, default is whatever the case in the sot
    // caseType: caseType,

    onSelect: function (ui) {
        console.log("address selected: " + JSON.stringify(ui));
    },

    onRetrieve: function (ui) {        
        //console.log('onRetrieve geocode address selected: ' + JSON.stringify(ui.onRetrieveItem));
        var addressData = ui.onRetrieveItem;
        document.getElementById('Line1').value = addressData.fullAddress;
        document.getElementById('input_1_4_1').value = `${addressData.flatUnitType} ${addressData.flatUnitNumber} ${addressData.floorLevelType} ${addressData.floorLevelNumber} ${addressData.streetNumber} ${addressData.street}`;
        document.getElementById('input_1_4_3').value = addressData.locality;
        document.getElementById('input_1_4_5').value = addressData.postcode;        
        //document.getElementById('Line1').setAttribute('readonly', 'readonly');

    },

    };

    al = HarmonyJS.addressLookup(
    document.getElementById('Line1'),
    'AUSTRALIA',
    'GNAF',
    opt
    );
                 
    var emailInput = document.getElementById('input_1_2');
    var emailOptions = {
            enabled: true, sot: "VE_ALL", options: [ "FORMAT",  "MAILBOX", "MAILSERVER", "DOMAIN", "BLACKLIST" ], //"FORMAT",  "MAILBOX", "MAILSERVER", "DOMAIN", "BLACKLIST"                      
            onValidating: function(email) { 
                console.log("Begin validating email address '" + email + "'"); 
                //additionalInfoInput.innerHTML = "";
            },
            onValidated: function(result) { 
                console.log("Email address " + result.payload.address + " is " + (result.isValid ? "valid" : "not valid")); 
                //additionalInfoInput.innerHTML = "<pre>" + JSON.stringify(result.payload, null, 4) + "</pre>";
                //id="gform_submit_button_15"
                document.getElementById('gform_submit_button_1').disabled = !result.isValid;
            },
            onError: function(messages) {
                console.log("Email validation error: " + messages.join("; "));
                //additionalInfoInput.innerHTML = "<pre>" + JSON.stringify(messages, null, 4) + "</pre>";
            }
        };
        
        emailInput.disabled = false;
        emailInput.value = "";
        //additionalInfoInput.innerHTML = "";
        HraEmailJS.emailValidation(emailInput, emailOptions);

    var phoneInput = document.getElementById('input_1_5');
    var phoneOptions = {
        enabled: true,
        getCountry: function() { 
            return "AU"; 
        },
        onValidating: function(phone) { 
            console.log("Begin validating phone number '" + phone + "'"); 
            //additionalInfoInput.innerHTML = "";
        },
        onValidated: function(result) { 
            console.log("Phone number '" + result.payload.fullPhone + "' is " + (result.status)); 
            //additionalInfoInput.innerHTML = "<pre>" + JSON.stringify(result.payload, null, 4) + "</pre>";
        },
        onError: function(messages) {
            console.log("Phone number validation error: " + JSON.stringify(messages, null, 2));
            //additionalInfoInput.innerHTML = "<pre>" + JSON.stringify(messages, null, 4) + "</pre>";
        }
    };        

    phoneInput.disabled = false;
    phoneInput.value = "";
    //additionalInfoInput.innerHTML = "";
    HraPhoneJS.phoneValidation(phoneInput, phoneOptions);

//id="gform_submit_button_15"

  }      
  
  window.onload=setupLoqate;

</script>

Set-up API Key and the above sample code in Gravity Forms

Testing your Installation

You are now ready to test connectivity within your form.

Configuration of requests

You can still use all our API settings (featureOptions).

For example using:

  • Dataset / SOT per country - Basic or Pro

You will need your Harmony API keys (see .)

Your user will need domain (e.g. *.wpcomstaging.com) added to key. See ()

See all here for particular services.

getting your api keys
allowlisting domain
AU Parcel Lockers
Derived sub-premise feature
Address featureOptions
free trial here
LoqateLoqate AU & NZ Demo
Logo