# Error Event fires incorrectly

**URL:** <https://community.hubspot.com/t/error-event-fires-incorrectly/147154>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [March 11, 2026, 8:34am UTC](https://community.hubspot.com/t/error-event-fires-incorrectly/147154 "2026-03-11T08:34:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MoKess](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@MoKess](https://community.hubspot.com/u/MoKess)\
**Post date:** [March 11, 2026, 8:34am UTC](https://community.hubspot.com/t/error-event-fires-incorrectly/147154/1 "2026-03-11T08:34:19Z")

</div>

We wanted to base the message about a failed form submission on the error event, but this also fires when data fields are filled in incorrectly or not at all, not just when something fails during transmission.

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [March 11, 2026, 12:02pm UTC](https://community.hubspot.com/t/error-event-fires-incorrectly/147154/2 "2026-03-11T12:02:08Z")

</div>

Hi @MoKess and welcome, we are so glad to have you here! 🧡  
Thanks for reaching out to the HubSpot Community!  
To start with, I’d like to share these resources for reference:  
- [Global form events](https://developers.hubspot.com/docs/api-reference/global-form-events/guide)  
- [Legacy forms](https://developers.hubspot.com/docs/cms/start-building/features/forms/legacy-forms)  
Could you please share the code you are using so that we can help you the best we can?  
The more info, screenshots (without sensitive/confidential information), and details you can provide, the better the Community can assist.  
Let’s consult our Top Experts: Hi @nickdeckerdevs1, [@zach\_threadint](https://community.hubspot.com/t5/user/viewprofilepage/user-id/324811) and @Anton do you have insights to share with @MoKess, please?  
Thanks so much and have a wonderful day!  
Bérangère

---

<div class="post-metadata">

**Author:** ![MoKess](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@MoKess](https://community.hubspot.com/u/MoKess)\
**Post date:** [March 12, 2026, 11:59am UTC](https://community.hubspot.com/t/error-event-fires-incorrectly/147154/3 "2026-03-12T11:59:09Z")

</div>

- **New Editor:** The “failure event” is over-reporting. It triggers on front-end validation errors (if someone puts a wrong email and a helper text appears) instead of strictly tracking submission failures. In my opinion validation events (wrong user input) should not be part of the submission failure event.
- **Old Editor (Code):** This version lacks distinct success/failure events, offering only a generic “form submitted” event. Since it returns an HTML response without a status indicator, it likely only tracks successful attempts.

onLoaded((hbspt) =\> {

try {

hbspt.forms.create({

portalId: portalID,

formId: formId,

target: target,

formInstanceId: instanceId,

locale: locale,

cssClass: ‘hubspot-form’,

onFormSubmitted: (e, data) =\> {

_// e is html raw response_

_// data is user submission_

_// we need to know in a deterministic way_

_// if the submission returned is a success or a failure_

submitted.value = true

}

});

} catch {

submitted.value = false

}

})

---

<div class="post-metadata">

**Author:** ![Berangere](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/berangere/32/220784_2.png) [@Berangere](https://community.hubspot.com/u/Berangere)\
**Post date:** [March 20, 2026, 4:23pm UTC](https://community.hubspot.com/t/error-event-fires-incorrectly/147154/4 "2026-03-20T16:23:04Z")

</div>

Hi @MoKess and thanks for sharing this code with us!  
So, for the New Editor (hs-form-event:on-submission:failed):  
This event fires when “the form submission failed,” but, when looking at the documentation “[Global form events](https://developers.hubspot.com/docs/api-reference/global-form-events/guide)”, it’s not clear if front-end validation errors are excluded. If the event triggers on things like an invalid email, even before the form is submitted to the server, that does seem unintended.  
This could be a small bug, and it’s a great idea to flag it for HubSpot support!

Regarding the Old Editor (hbspt.forms.create / onFormSubmitted):  
You’re right, the legacy embed code’s onFormSubmitted callback only lets you know about successful submissions and doesn’t separate out failures.

Here is what you can do:  
If the new editor is reporting failures for simple validation issues, I’d recommend reaching out to HubSpot support.  
For [legacy forms](https://developers.hubspot.com/docs/cms/start-building/features/forms/legacy-forms), there isn’t a built-in way to tell the difference between success and failure in onFormSubmitted.

Hope this helps!  
Have a brilliant weekend @MoKess!  
Bérangère  
_This post was created with the assistance of AI tools_
