Please create a Global onFormSubmit Callback


#1

I’ve mentioned this several times now, but it keeps presenting itself as more of a need as time goes on.

When a portal has 100+ forms and you need to run a specific javascript function (say for 3rd party tracking applications) HubSpots forms do a gigantic faceplant.

Yes, we could go into every form embed code and add an onFormSubmit callback to the embed code, but that also fails when the form is implemented using a COS form module (the module doesn’t provide an option to hook into that callback…) and not manually placed with an embed code. But copying and pasting the same function into 100 JS callbacks isn’t DRY programming, and it makes maintenance and gigantic pain. Not to mention any new forms added to landing pages by non-developers won’t know how to add these callbacks.

What we desparately need is a GLOBAL onFormSubmit callback that could be used something like:

hbspt.forms.onFormSubmit(function($form){
    // my js to run on successful submit here.
});

Because HubSpot encourages the use of 100’s of forms and unique LPs and TY pages developers need more control over how we can extend the forms using global options inside the forms library.

Please consider this seriously, Marketo does this and I can’t understand why HubSpot wouldn’t want to provide something similar to compete.


#2

Hi @derekcavaliero,

While this isn’t currently possible, I can totally see the use case here, and I’d be happy to pass this feedback along internally. If you have the inclination, I would encourage you to check out the Ideas Forum on the HubSpot Community. There, you can create a post including your use case that product and other customers can see.


Waiting for hsvalidatedsubmit event to complete
#3

Thanks for the response @Derek_Gervais

I actually have submitted this there before (or it was migrated from the legacy feedback forum) - but I haven’t ever had any response…

See: https://community.hubspot.com/t5/HubSpot-Ideas/Add-Global-Callback-Functions-Listeners/idi-p/11510

Anything that can get this request into the product team would be beneficial and greatly appreciated. Really all of the form callbacks (onBeforeFormInit, onFormReady, onFormSubmit) would be incredibly useful to have access to at a global level.


#4

Hi @derekcavaliero,

I’ll touch base with the team for more information on this issue; it’s possible there’s context that I’m missing that might explain why this isn’t a feature at the moment. I’ll reach out here when I have more info.


#5

@derekcavaliero @Derek_Gervais
I also would love to see this implemented. As discussed in Waiting for hsvalidatedsubmit event to complete I’ve been relying on hsvalidatedsubmit to track analytic events across both embedded and landing forms for several years now and have seen significant reliability issues.