onFormSubmit Not Firing




I have a form. Here’s the code:

<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<script charset="utf-8" type="text/javascript" src="https://js.hsforms.net/forms/v2.js"></script>

    css: '',
    portalId: '1946113',
    formId: 'dbb80b0f-244e-48b9-af75-2f977ad63838',
    onFormSubmit: function() {
        // doFormSuccessTracking();

OnFormSubmit isn’t firing on Success. Thoughts?


@Nicholas_Cerminara you might need to update your tracking code. I would try and get the fresh embed script from HubSpot and try again. Some of the older embedded tracking scripts did not support the callback in the forms.


Are you guys higher than v2 now?


@Nicholas_Cerminara That is the forms embed code. Do you have the HubSpot tracking code on the page as well?


I didn't know jQuery was required. It just fails silently without it. I ended up mocking a couple jQuery functions and it started working.

This is required to run `onFormSubmit` in the hubspot `form.create({...})` API.
window.jQuery = window.jQuery || (elm => {
  elm.change = () => {};
  elm.trigger = () => {};
  return elm;