APIs & Integrations

CameronJRC
Miembro

FORMS - Modifying Input Value on onFormSubmit

I am able to pull information from the Global Form Event listener. 

 

 

window.addEventListener("message", function(event) {
    if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') {
        console.log(event.data.data);
    }
});

 

 

I require modifying the data values which isn't effected by direct edits to the event.data.data values and the form isn't obtainable through $('#formid') due to the hubspot form being enclosed within an iFrame. 

 

The API documentation doesn't seem clear on this and previous threads push the $(input=name).val().change() which has the same issue as obtaining the form directly as above. 

 

Has anyone solved this through a documented API or is it neccessary to muddle together a hacked solution?

 

Thanks.

2 Respuestas 2
MKapustin
Participante

FORMS - Modifying Input Value on onFormSubmit

Is it possible to modify the event.data.data object directly withouth messing with input values? Doesn't seem to work for me...

0 Me gusta
WendyGoh
HubSpot Employee
HubSpot Employee

FORMS - Modifying Input Value on onFormSubmit

Hey @CameronJRC,

 

When looking to modify the form embed code, you would need to set the form as a raw HTML as that the form will render as a raw HTML element on your page as opposed to inside an iframe.

 

More details here: Style your embedded form on external pages.

0 Me gusta