Form fields get blanked out


I made a Hubspot form with several custom fields that are filled with values from the page through my own local javascript like

$("#fieldname").val(“my custom text”);

(These fields are supposed to be input type=hidden later.)
But I noticed while still in development when they are visible, as soon as I click on a regular field to edit it, all my custom field values are blanked out/go back to default.

Anyone know what I can do about this?


@Paul1 HubSpot forms are built using ReactJS, so you’ll need to explicitly call the change event on the fields for them to update.


Thank you very much. Adding .change() to my .val() took care of this.


$("#fieldname").val(“my custom text”).change();