Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom integration of post code anywhere
pca.on("load", function (type, id, control) {
control.listen("populate", function (address) {
console.log('here');
});
});
// 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
You can’t perform that action at this time.