I have a landing page that is called from a third party, and they pass in some query parameters. I want to pre-populate some of my form variables using the values for these parameters.
Because the form does not exist when onDomContentReady fires, I am forced to poll for the presence of the form fields. Once the fields are present, I update the form field values. Unfortunately, immediately after I do this, HubSpot deletes the values I set because their is nothing in the database mapped to that field.
I can think of a couple better ways to do this, but I don’t know if the API supports it.
- Firstly, does the form api have an event it fires that I can attach a listener as to when the form has rendered? This would at least allow me to skip the hacky polling process.
- Secondly, is it possible to configure the code that loads the form to provide form values to use in lieu of what HubSpot thinks is in the database?
For those that suggest I wait 100 ms after the form fields are present to write my values in place in order to defeat the React code that clears the field… On any validation event, the form fields are again wiped out by HubSpot. That wouldn’t be good behavior under any conditions, so I’m not sure what is going on there.
Thanks for any assistance.