APIs & Integrations

DValencia3
Participant

onFormSubmit event.data returns object instead of array

SOLVE

Hi, this is something that was already discussed here but not solution was actually provided.

 

onFormSubmit should return event.data as an array but it is returning an object instead.

Expected result:

Screen Shot 2022-09-29 at 10.50.24 AM.png

 

Actual Result

Screen Shot 2022-09-29 at 3.03.54 PM.png

1 Accepted solution
LeeBartelme
Solution
HubSpot Employee
HubSpot Employee

onFormSubmit event.data returns object instead of array

SOLVE

I agree that is pretty weird. I've never seen that before. Have you tried to contact support. I imagine they might say it's custom code and to post here, but it's worth a shot.

Notice the ?pre=1 on the js file. Try removing that and see if it makes a difference as it's not on your working example. I think they maybe are making changes to the JS and that is toggling the new vs the old. 

If that fixes it, I'd report it to support as a bug.

View solution in original post

6 Replies 6
LeeBartelme
HubSpot Employee
HubSpot Employee

onFormSubmit event.data returns object instead of array

SOLVE

Wow I actually wish it returned an object and not an array, that's weird. Do you have jQuery on your page? I know that other post was talking about an empty object, but just crossing t's here.

DValencia3
Participant

onFormSubmit event.data returns object instead of array

SOLVE

Thank you for your quick answer, Lee.

I do not think jQuery is the problem, here is why.

 

This is the form on my test site, no jQuery (however I did test it with jQuery on it). On this test site, it does return the array as expected.

 

This is live site form (you need to click the first option to open the form). Live site does have jquery. But it is returning an object instead of an array. 🙃. I am lost with this, we have a workardound applied but I want to make sure this doesn't break in the future.

0 Upvotes
LeeBartelme
Solution
HubSpot Employee
HubSpot Employee

onFormSubmit event.data returns object instead of array

SOLVE

I agree that is pretty weird. I've never seen that before. Have you tried to contact support. I imagine they might say it's custom code and to post here, but it's worth a shot.

Notice the ?pre=1 on the js file. Try removing that and see if it makes a difference as it's not on your working example. I think they maybe are making changes to the JS and that is toggling the new vs the old. 

If that fixes it, I'd report it to support as a bug.

DValencia3
Participant

onFormSubmit event.data returns object instead of array

SOLVE

@LeeBartelme One last question that concerns me.

 

It looks like v2.js?pre=1 is a variant of the working version v2. Are you running an experiment? It is possible to see pre=1 version deployed in the future?

0 Upvotes
LeeBartelme
HubSpot Employee
HubSpot Employee

onFormSubmit event.data returns object instead of array

SOLVE

I'm not on that team. So I don't know what they are doing. I assume it's what you are saying. Sorry I don't have more information. 

0 Upvotes
DValencia3
Participant

onFormSubmit event.data returns object instead of array

SOLVE

That was it! Thank you so much!

0 Upvotes