Hubspot form: programmatically set field value via jQuery
On friday I had to use your event implementation, because it still not works for me.
Infact, the value got overridden by the “old values” from hubspot.
With your “notifyHubspot” react recognizes the first change and stops the overwriting.
Don’t know if it’s clear enough.
Hubspot form: programmatically set field value via jQuery
@LucaBartoli, We too were having hard time in inserting values dynamically, into input box, now it seems to working.
We were not sure if it was from HS or from our end,whenever we import jquery library from cdn, it gave us error. This time we pasted library on page using hubl. $(‘input[name=“firstname”]’).val(“damiano”).change();
We got it working.
Hubspot form: programmatically set field value via jQuery
We are using the hubspot provided jquery
I think the problem is a little different, because we have no problems in notifying Hubspot normal changes. We have problems in notifying hubspot the first set-up of the fields.
This is necessary because Hubspot automatically selects the old values from the user, but does not notify the changes with any event. We need to reset the form due to this, because Hubspot is slower than our script. So, when we set values before hubspot set its ones, these are overwritten.
Hubspot form: programmatically set field value via jQuery
Still no significant response from HS,they say they are still “investigating”.
I ended up with a slighlty different code that triggers 3 different events (not just the “change” event) using vanilla js instead of jQuery. The conclusion is that there must be a problem with jQuery events and React/Hubspot Forms.
Hubspot form: programmatically set field value via jQuery
Still experiencing this issue in Nov 2022... Your solution seemed to work.
FYI for others, looks like some events work with some browsers, and throw errors in others (thus your multiple events and try catches). We found Safari based browsers to be annoying.
Hubspot form: programmatically set field value via jQuery
From my recent experience, the problem is the form is injected after window load by ReactJS.
Furthermore, the hubspot forms have a callback only if injected inside external websites, but not if injected as modules.
We resolved this issue by testing the existance of the form and calling a custom event, to which we attached all manipulations.
Hubspot form: programmatically set field value via jQuery
I’m experiencing the same problems since last Friday. Same code just stop to working since then. I opened a ticket on HS but they said the API are normal and no updates lately. Looking forward to hear any updates and solutions.
Hubspot form: programmatically set field value via jQuery
@damiano.seno.domino Any updates here? I’m working on a subscription page with check/uncheck for email preferences and just struggling with no good result