Last active
February 24, 2020 17:13
-
-
Save thomaslorentsen/b362857003b8c15e13015193c5940145 to your computer and use it in GitHub Desktop.
Custom integration of post code anywhere
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pca.on("load", function (type, id, control) { | |
control.listen("populate", function (address) { | |
console.log('here'); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Replace key with pca key | |
// Refer to documentation http://www.pcapredict.com/capture-plus/reference/2.20/pca.Address.html#Options | |
var options = {key: 'XXXX-XXXX-XXXX-XXXX', filteringMode: 'Address'}; | |
if (typeof pcakey !== 'undefined') options.key = pcakey; | |
// For field bindings refer to documentation http://www.pcapredict.com/capture-plus/reference/2.20/pca.Address.html#Binding | |
// Field modes refer to documentation http://www.pcapredict.com/capture-plus/reference/2.20/pca.html#fieldMode | |
var fields = [ | |
{element:'postcode', field: "{PostalCode}", mode: 3}, | |
{element:"buildingNum", field: "{BuildingNumber}", mode: 2}, | |
{element:"line1", field: "{Street}", mode: 2}, | |
{element:"line2", field: "{Line2}", mode: 2}, | |
]; | |
pca.ready(function() { | |
// Create a new address field | |
control = new pca.Address(fields, options); | |
// Listen to events | |
control.listen('populate', function() { | |
// This function get called when an address has been selected | |
console.log('Populated Event'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment