Postal Code Lookup for auto populating City/State

Anonymous
Not applicable

Postal Code Lookup for auto populating City/State

Hello Community,

Currently, we have some .js and php running to populate city/state on Forms 1.0 based on postal.zip code information provided in the form during submission.  

We are trying to migrate over to Forms 2.0 and I was cruious to understand if anyone has implemented or worked with a vendor to achieve this?  I've checked similar questions and articles, but could not find anything that was recent.

Thanks!
Tags (1)
8 REPLIES 8
Anonymous
Not applicable

Re: Postal Code Lookup for auto populating City/State

Edwin,

I don't fully understand what you're currently doing and why it's dependent on the 1.0 form.  

That said, there are plenty of vendors out there such as ZoomInfo, Leadspace, Mintigo and others who will work with you to implement a webhook to their systems, through which you can augment lead data post form-submission. To my knowledge, the type of form you're on doesn't make or break the webhook setup with any of these providers.
Anonymous
Not applicable

Re: Postal Code Lookup for auto populating City/State

Hi Nate,

First, thanks for your reply!  I'm not after data enrichment post submission; rather, I'm looking for City/State auto population before form submission based on a provided Postal Code (on our marketo landing page/form).

In Forms 1.0, a form is composed of various elements.  They have class/id properties.  Given its id property, you can manipulate what is populated in the textboxes via javascript/jquery (#id).  In our case, we look at the Postal Code field on the form and actively populate the City/State for the user.

In contrast, Forms 2.0 is rendered in a different fashion where everything is written as function and a .js file is referenced instead.  I'm curious if there's a solution out there that achieves the functionality described above, but for Forms 2.0.

Thanks again!
Anonymous
Not applicable

Re: Postal Code Lookup for auto populating City/State

Edwin, is it imperative that you populate the City and State of the user based on the postal code entered? If it is, then I'm not sure how you would manipulate that data without a webhook to a vendor like Ringlead or something.

If not, you could create a smart campaign that listens for  a lead being created that has no explicit city or state on entry, and then in the flow action appends the Inferred City / State region.

Something like this:

0EM50000000S5LE.jpg
 
Justin_Donlon
Level 2

Re: Postal Code Lookup for auto populating City/State

Hi Edwin

Did you ever find a solution to this?

Danny_Tran5
Level 3

Re: Postal Code Lookup for auto populating City/State

Several years later, I am also wondering about this.

Jay_Jiang
Level 10

Re: Postal Code Lookup for auto populating City/State

Hook up your external service to the field using the forms API

e.g. with fictional service

function postalCodeLookup(postalCode){
$.ajax({
method:'POST',
url: '//your.webhook.com/endpoint',
data: postalCode, // you might need an api key or access token
dataType:'json', // if data is returned as json
success:function(data){
$('#City').val(data['city']); // how the data is returned varies depending on your webservice
$('#State').val(data['state']);
console.log("Lookup success");
},
error: function(xhr) {
console.log("Lookup error");
}
});
}

MktoForms2.whenReady(function (form) {
$('#PostalCode').change(function(){
postalCodeLookup($(this).val());
});
});

Obviously you will need to know some coding to deploy the service

SanfordWhiteman
Level 10 - Community Moderator

Re: Postal Code Lookup for auto populating City/State

Already done a couple of years ago: MktoForms2 :: Google Places Zip v1.0.2 

There are other APIs (some a lot less complex and just as accurate) but this uses the Google Maps Geocoder.

Obvs. you'd want to fine-tune the interaction between auto-filled fields and manually entered fields... this is just a simple demo.

Danny_Tran5
Level 3

Re: Postal Code Lookup for auto populating City/State

Thanks for this, Sanford. As always your help is ultra appreciated.