APIs & Integrations

Leotta
Membre

Convert post codes to address in the form

Hi,

I would like to create a form where a post code is automatically converted to an address when a user type there.

How can I implement this feature?

0 Votes
3 Réponses
Laragón
Membre | Partenaire solutions Elite
Membre | Partenaire solutions Elite

Convert post codes to address in the form

It is necessary to integrate the Google Maps Geocoding API into the page.

First what you have to do is obtain a google maps api key, then you need to configure through scripts the call to the Geocoder api, where you pass the zip code and you will get a result with data such as latitude, longitude and formatted address that you can use to be able to fill in what you want.

0 Votes
Leotta
Membre

Convert post codes to address in the form

Thank you so much for your answer and sorry for my late reply.

In fact, I'm quite new to HubSpot.

How can I make a javascript file that works on the form?

0 Votes
SAMsan
Contributeur

Convert post codes to address in the form

It looks like you'll have to create a XHR request from the page embedding the form to any external geocoding service like Google Places API or so. Knowing that geocoding may lack precision.

Depending on embedding page, it could be tough to accomplish, but integration essentially consists of listenning form events to trigger geocoding task.  For Wordpress based sites, Leadin extension allows usage of form hooks easily. 

0 Votes