JavaScript Code Generator


Generate a JavaScript code snippet to find and validate addresses on website forms

Address Validation Code Generator

Locate the address field ids on your website, enter them into the code generator below and a JavaScript code snippet will be generated that can be deployed on your website to find and validate NZ addresses in real-time.

JavaScript Code Generator
API Key: * create a key

Address Form Fields

Fill in as many of the fields below that will be populated when an address is selected.
Address Field id: * how to find it
Address Field 2 id: (e.g. Address Line 2):
Suburb Field id:
City / Town Field id:
Postcode Field id:
Address Validation Code Snippet

How to find address field ids

Locating the address field ids on your website is easy. Just follow the steps below.

  1. Browse to the address form page of your website (e.g. the checkout or sign-up page)
    Here is an example address checkout form

  2. Right click on the address input field and select "Inspect" (Chrome) or "Inspect element" (Edge / IE) as shown below.

    Address Id Field using Chrome
  3. The input field should look similar to the HTML code below:

    <input type="text" id="address_field_1" />

  4. Write down the id of the input field. In the exampe above it is "address_field_1".

  5. Repeat steps 2 - 4 for each input field id such as "suburb" and "city"

Now that you have all of the address field ids, you can use the address validation code generator.

Use the button below to generate JavaScript code for the demo address checkout form.

Generate Demo Code

Stuck or need help? Get in touch. Our team would be happy to support you via email or over the phone.

Testing address validation in your web browser

Follow the steps below to test the address validation code snippet in your browser, with no installation or web deployment required.

  1. Browse to the address form page of your website (e.g. the checkout or sign-up page)
    Here is an example address checkout form

  2. Press F12 on your browser (e.g. Chome, FireFox, Edge, IE) to open the developer tools and click on the Console tab.

  3. Copy and paste the generated code snippet into the console window and press "Enter" as shown below.

    Chrome Example:

    Address Validation using Chrome Console

    Internet Explorer / Edge Example:

    Address Validation using Edge Console

    FireFox Example:

    Address Validation using FireFox Console
  4. Verify that the address autocomplete functionality is working by typing in an address on the page.

Use the button below to generate and test the JavaScript code in your browser using the sample address checkout form.

Generate Demo Code

Note: The code snippet pasted into your browser console window will be reverted once the page is reloaded.

Installation Options

Use one of the follow techniques to publish the code snippet to your website: