# onFormSubmit event.data returns object instead of array

**URL:** <https://community.hubspot.com/t/onformsubmit-event-data-returns-object-instead-of-array/66200>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [September 29, 2022, 7:04pm UTC](https://community.hubspot.com/t/onformsubmit-event-data-returns-object-instead-of-array/66200 "2022-09-29T19:04:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DValencia3](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@DValencia3](https://community.hubspot.com/u/DValencia3)\
**Post date:** [September 29, 2022, 7:04pm UTC](https://community.hubspot.com/t/onformsubmit-event-data-returns-object-instead-of-array/66200/1 "2022-09-29T19:04:39Z")

</div>

Hi, this is something that was already discussed [here](https://community.hubspot.com/t5/APIs-Integrations/Global-form-event-not-returning-expected-values-for-data/td-p/273566) 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](https://d2qpr2jzcazej7.cloudfront.net/original/2X/3/3b9b19eed48c920b14caede52b13e3588f9c4cf8.png)

Actual Result

 ![Screen Shot 2022-09-29 at 3.03.54 PM.png](https://d2qpr2jzcazej7.cloudfront.net/original/2X/4/484c304f1f08e96c8ad70734758f69e0ec517345.png)

---

<div class="post-metadata">

**Author:** ![LeeBartelme](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/leebartelme/32/95647_2.png) [@LeeBartelme](https://community.hubspot.com/u/LeeBartelme)\
**Post date:** [September 29, 2022, 7:08pm UTC](https://community.hubspot.com/t/onformsubmit-event-data-returns-object-instead-of-array/66200/2 "2022-09-29T19:08:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DValencia3](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@DValencia3](https://community.hubspot.com/u/DValencia3)\
**Post date:** [September 29, 2022, 7:18pm UTC](https://community.hubspot.com/t/onformsubmit-event-data-returns-object-instead-of-array/66200/3 "2022-09-29T19:18:21Z")

</div>

Thank you for your quick answer, Lee.  
I do not think jQuery is the problem, here is why.

[This](https://imperfect-crook.surge.sh/hubspot) 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](https://fadv.com/get-started/) 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.

---

<div class="post-metadata">

**Author:** ![LeeBartelme](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/leebartelme/32/95647_2.png) [@LeeBartelme](https://community.hubspot.com/u/LeeBartelme)\
**Post date:** [September 29, 2022, 7:23pm UTC](https://community.hubspot.com/t/onformsubmit-event-data-returns-object-instead-of-array/66200/4 "2022-09-29T19:23:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DValencia3](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@DValencia3](https://community.hubspot.com/u/DValencia3)\
**Post date:** [September 29, 2022, 7:33pm UTC](https://community.hubspot.com/t/onformsubmit-event-data-returns-object-instead-of-array/66200/5 "2022-09-29T19:33:57Z")

</div>

That was it! Thank you so much!

---

<div class="post-metadata">

**Author:** ![DValencia3](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@DValencia3](https://community.hubspot.com/u/DValencia3)\
**Post date:** [September 29, 2022, 8:12pm UTC](https://community.hubspot.com/t/onformsubmit-event-data-returns-object-instead-of-array/66200/6 "2022-09-29T20:12:25Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![LeeBartelme](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/leebartelme/32/95647_2.png) [@LeeBartelme](https://community.hubspot.com/u/LeeBartelme)\
**Post date:** [September 29, 2022, 8:15pm UTC](https://community.hubspot.com/t/onformsubmit-event-data-returns-object-instead-of-array/66200/7 "2022-09-29T20:15:09Z")

</div>

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.
