Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Custom integration of post code anywhere
pca.on("load", function (type, id, control) {
control.listen("populate", function (address) {
// Replace key with pca key
// Refer to documentation
var options = {key: 'XXXX-XXXX-XXXX-XXXX', filteringMode: 'Address'};
if (typeof pcakey !== 'undefined') options.key = pcakey;
// For field bindings refer to documentation
// Field modes refer to documentation
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.