• Live group demo of Marketing Hub + Data Agent

    Standardize reporting, reduce manual work, and introduce AI without cleanup

    Join us on March 12
  • Ready to build your local HubSpot community?

    HUG leaders host events, spark connections, and create spaces where people learn and grow together.

    Become a HUG Leader

Convert post codes to address in the form

Leotta
Member

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 Upvotes
3 Replies 3
Laragón
Member | Elite Partner
Member | Elite Partner

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 Upvotes
Leotta
Member

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 Upvotes
SAMsan
Contributor

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 Upvotes