APIs & Integrations

shivashankari
Member

onFormSubmitted does not return form data

I am trying to retrieve the form data through the onFormSubmitted event.

Why am I seeing empty data?

data: { }

 

(Form was submitted and contact was created in HubSpot.)

3 Replies 3
AlexeyVorobyov
Participant

onFormSubmitted does not return form data

Hi @lscanlan ,

 

it would be very useful to retrieve the data that was sent, also in the `onFormSubmitted` event.

There is an edge case when it assumed that the form was submitted, but in reality, it was not, because of

email or phone not passing the validation - in this case, `onFormSubmit` happened, but not `onFormSubmitted` which makes sense. My point is to use the `onFormSubmitted` event as a fact of form is really submitted and data is sent, but since it does not pass the `data` object along, it can't be used for extra "success logic"(sending internal logs with contact data filled in, e.g.) 

0 Upvotes
lscanlan
HubSpot Alumni
HubSpot Alumni

onFormSubmitted does not return form data

Hi @shivashankari,

 

Just editing my reply here, since I realize now that you're using the global form events documented here: https://developers.hubspot.com/global-form-events. In that case, yes. The data object will be populated with the submission from the onFormSubmit event, as you can see in that doc. On the other hand, onFormSubmitted (which fires after the submission is processed), will contain just an empty data object.

 

Leland Scanlan

HubSpot Developer Support
LaurenceBN
Member

onFormSubmitted does not return form data

In that case please kindly update the documentation, it has been 4 years now...

LaurenceBN_0-1689083300544.png

 

0 Upvotes