Skip to main content
July 1, 2014
Question

Postal Code Lookup for auto populating City/State

  • July 1, 2014
  • 5 replies
  • 4725 views
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!
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

5 replies

July 1, 2014
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.
July 1, 2014
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!
July 1, 2014
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:


 
Justin_Donlon
Level 2
February 24, 2016

Hi Edwin

Did you ever find a solution to this?

Level 3
June 12, 2019

Several years later, I am also wondering about this.

Jay_Jiang
Level 10
June 13, 2019

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