We added custom javascript to our customers landing page. When you type a company name in the company field, we provide a picklist of options. When user selects a company from the picklist, our javascript changes value to the selected value, but HubSpot is changing the value back to the originally typed value.
Has anyone seen this? If you can provide any suggestions or assistance we would appreciate it.
I've run into this before. Make sure that after you update the fields value via JavaScript - that you also explicitly trigger a "change" event.
They don't really say "why" you need to do this - but I suspect it has something to do with the way the form is mounted via React and that without a "change" event - the "state" or "Single Source of Truth" object doesn't get properly updated and reverts to the state that was stored from the last change/render event.
Thanks Derek, this helped resolve the issue we were facing, but we have encountered another similar issue:
Our developers were able to set values using above solution and it worked. But we came across another issue where dropdowns/picklists are not updating.
Thats strange - mind providing me a code example so I could see how you're prefilling those fields? I do remember some oddities - but seeing an example might help refresh my memory :D.