Skip to main content

Forminator

Add address autocompletion and postcode lookup to your Forminator pages.

info

If you need support, you can either reach out to us on our support page or drop by our developer chat page.

Demo

Address Finder Demo

Activate Address Finder on your address collection forms-screenshot

Postcode Lookup Demo

Quickly populate your address fields-screenshot

Form Creation

This integration works by adding our Address Validation tools using Forminator's form editor. Below are the instructions to add Postcode Lookup or Address Finder.

Add address input fields to your form. To do so, click 'insert fields' and select input. Once clicked, you can update the label text.

A basic address form to capture a correct UK address should have the following fields:

  • Address line one (required)
  • Address line two
  • Address line three
  • Post town (required)
  • Postcode (required)

Create address fields-screenshot

You can optionally include additional fields, which are listed in the Address data guide.

info

Make a note of the name generated for your input field.

Forminator input name

Installation

Add Address Finder

On the WordPress admin dashboard, click on the 'Pages' tab, followed by 'Add New'. Now, click on the 'shortcode'and paste your Forminator shortcode in. Next click on 'Add block' icon and look for the 'Custom HTML' component. Add the following two script tags within the HTML block to load the plugin and then to initialise it.

Initialise Address Finder

<script src="https://cdn.jsdelivr.net/npm/@ideal-postcodes/address-finder-bundled@4"></script>

<script>
document.addEventListener("DOMContentLoaded", function () {
IdealPostcodes.AddressFinder.setup({
apiKey: "ak_test",
outputFields: {
line_1: 'input[name="text-1"]',
line_2: 'input[name="text-2"]',
line_3: 'input[name="text-3"]',
post_town: 'input[name="text-4"]',
postcode: 'input[name="text-5"]'
}
});
});
</script>
caution

Take special care to:

  1. Insert your API Key in the apiKey field
  2. Match the names of your address fields. If your Address Line One has name = text-1, ensure that line_1 reads 'input[name="text-1"]'

If you wish to add an additional field, include the parameter name from our documentation. For instance, adding a county field with name county will look like:

outputFields: {
line_1: 'input[name="text-1"]',
line_2: 'input[name="text-2"]',
line_3: 'input[name="text-3"]',
post_town: 'input[name="text-4"]',
postcode: 'input[name="text-5"]'
uprn: 'input["name-text-6"]'
}

Add Postcode Lookup

Add Postcode Lookup HTML elements

In your form builder, insert a new field. Choose HTML and make sure you place it above the first input field of your address form. Copy and paste the HTML code below.

Fluent Form Postcode Lookup setup

  <div id="idpc"></div>

Next, go to your page and create an html block at the bottom of the form and add the script below.

Enter script into the code editor-screenshot

<script src="https://cdn.jsdelivr.net/npm/@ideal-postcodes/postcode-lookup-bundled@2">
</script>

<script>
IdealPostcodes.PostcodeLookup.setup({
apiKey: "ak_test",
context: "#idpc",
outputFields: {
line_1: 'input[name="text-1"]',
line_2: 'input[name="text-2"]',
line_3: 'input[name="text-3"]',
post_town: 'input[name="text-4"]',
postcode: 'input[name="text-5"]'
},
});
</script>

If you wish to add an additional field, choose a parameter from our UK Address data guide. For instance, adding a county field with name county will look like:

outputFields: {
line_1: 'input[name="text-1"]',
line_2: 'input[name="text-2"]',
line_3: 'input[name="text-3"]',
post_town: 'input[name="text-4"]',
postcode: 'input[name="text-5"]'
uprn: 'input["name-text-6"]'
}

Configuration

See our Address Finder Plugin Documentation if you wish to customise Address Finder.

See our Postcode Lookup Plugin Documentation if you wish to customise Postcode Lookup.