...
The following provides details on implementing address validation for a Screen Layout using NC builtin Java Script editor.
NOTE: for the validation to work the campaigner system must be running https and you must use a https address validation server due to javascript ajax cross domain browsing limitations.
The address validator needs to be initialised during the onConnect processing.
e.g.
Code Block | ||||
---|---|---|---|---|
| ||||
jQuery.njDialerPlugin.onConnect= function () { jQuery.njDialerPlugin.enableAddressValidation("AddressLine1", "Suburb" , "State", "PostCode", <URLKey>, <URL>); }; |
AddressLine1 needs to be replaced with the name of the field that is to accept the address input. This would normally be the first line of the address. Once the address has been validated the AddressLine1, Suburb, State and Postcode will be automatically populated with the result.
<URLKey> must be replaced with a URL Key which activates your address validation license. You need to obtain this from Noojee.
<URL> is the URL of the service used to do the address validation. You need to obtain this from Noojee.
DataTools have updated their method for address validation.
You will need to sign up to a Data Tools account for Express Capture and create an API key. As part of creating a new key, DataTool's wizard will provide some HTML to drop in to a web page, but this doesn't work with Noojee Adamin.
DataTools will provide something like:
Code Block | ||
---|---|---|
| ||
<script type="text/javascript" src="http://expresscapture.datatoolscloud.net.au/js/expresscapture-2.20.min.js?key=API KEY GOES HERE"></script>
<link rel="stylesheet" type="text/css" href="http://expresscapture.datatoolscloud.net.au/css/expresscapture-2.20.min.css?key=API KEY GOES HERE" /> |
Because where the javascript was in the html wasn’t being called, the CSS is left in the HTML source and the call to the javascript is put in the ‘Java script’ section, in the ‘$.njDialerPlugin.onConnect’ function.
In addition an attribute has been added to the address fields to remove google chromes auto-complete as it was getting in the way.
Therefore, drop the following in the HTML source
Code Block | ||
---|---|---|
| ||
<link href="https://expresscapture.datatoolscloud.net.au/css/expresscapture-2.20.min.css?key=API KEY GOES HERE" rel="stylesheet" type="text/css" /> |
and drop the the javascript call in the 'Java Script' section in the onConnect method:
Code Block | ||
---|---|---|
| ||
$.getScript( "https://expresscapture.datatoolscloud.net.au/js/expresscapture-2.20.min.js?key=API KEY GOES HERE", function( data, textStatus, jqxhr ) {
$('#lead_fieldaddress1').attr('autocomplete','new-password');
$('#lead_fieldsuburb').attr('autocomplete','new-password');
$('#lead_fieldstate').attr('autocomplete','new-password');
$('#lead_fieldpostcode').attr('autocomplete','new-password');
}); |
Save modifications and click on preview and trigger the onConnect method. DataTool's setup bar will load at the bottom of the screen where you will have the enter the verification code provided from the Data Tool's API Key creation tool.
Follow the wizard for mapping the fields and test.