Hubspot form: programmatically set field value via jQuery
@Derek_Gervais I'm also having this problem and would really love some help with it.
My use case is leveraging the google maps API to provide autocomplete functionality for the address field. Everything works fine except for that the HS form code keeps clearing the autocompleted values. Tried every variation of jQuery we could think of, but HS keeps clearing the value.
As a general rule, it's better to create a brand new forum post than to post on an older one (>1 year old). Issues from greater than one year ago have usually been resolved, and aren't directly related to new/current issues.
That said, I'm happy to dive into whatever is going wrong here. Can you post a link to the page you're referring to so that I can take a closer look?
The Document.load method isn't the best event for this; that event fires when the DOM is loaded, but HubSpot forms are loaded dynamically by the form embed code. You should put the form field related code in the built-in onFormReady callback:
I modified it in order to pull only the data we need but I think I’m missing out something. With these changes, the form doesn’t redirect, it works because the data is sent, but the redirect doesn’t happen so I think it’s something related to the variables using the parameter “redirectUrl”