Even when I tried keeping the value inside a visible text field, it was automatically cleared on click because HubSpot’s form script reinitializes the field inputs on interaction. After further inspection, I discovered a hidden field named hs_context, which contains all field values in JSON format. This JSON object is what HubSpot actually uses for submission — meaning any custom values set through regular inputs are overwritten by what’s inside hs_context at the time of submit. I attempted to inject our custom data directly into the hs_context object, and while the field shows the correct value in the form, HubSpot still doesn’t allow these script-injected values to persist through submission. This behavior appears to be part of HubSpot’s built-in data validation and security layer. Code :
Hey @JeetuDubey, when using the embed code of a form, you need to consider that it will be loaded in an iframe and modifying values inside an iframe is not best practice. You'll run into cross-origin restrictions and it's generally a security nightmare.
Hey @JeetuDubey, when using the embed code of a form, you need to consider that it will be loaded in an iframe and modifying values inside an iframe is not best practice. You'll run into cross-origin restrictions and it's generally a security nightmare.