Custom Javascript to add Google Places Autocomplete to Form


#1

Hi,

I am currently trying to add a custom javascript file to my hubspot form.

This custom javascript is putting places autocomplete on 2 of the form inputs. This is working as expected but the value returned from the autocomplete gets removed from the field when you click elsewhere on the form- ie. the value is not saved to the input element.value.

Any one ever seen behaviour like this before?

Thanks


#2

Hi @sgpbyrne

HubSpot forms are built using React, so depending on how the fields are being updated, you may need to manually trigger the change event for the field.

We have a few examples using jQuery for this here:


#3

Great, thanks for that information - worked perfectly.