International Forms
Show or hide the Find button when different countries are selected from a drop down list
Overview
Because the Postcode Lookup service only provides UK data, the Postcode Lookup script will auto-hide the "Find" button when a country other than the UK is selected.
To use this functionality, just set the expectedCountry
option to the value that must be selected in this drop-down list before the "Find" button is shown.
<select id="country"> <option value="AF">Afghanistan</option> <option value="AX">Åland Islands</option> ... <option value="GB">United Kingdom</option> <option value="US">United States</option> ... </select> <script type="text/javascript"> new data8.postcodeLookupButton( [ { element: 'company', field: 'organisation' }, { element: 'address1', field: 'line1' }, { element: 'address2', field: 'line2' }, { element: 'address3', field: 'line3' }, { element: 'city', field: 'town' }, { element: 'county', field: 'county' }, { element: 'postcode', field: 'postcode' }, { element: 'country', field: 'country' } ], { // Change this to your own Ajax key ajaxKey: 'your-ajax-key', // Change this to your postcode lookup license type license: 'WebClickFull', expectedCountry: 'GB' } ).show(); </script>