Noobie alert: Native form's onSubmit event handler or hook?



Hi guys, this is my first stab at any HS development. We’re integrating with SalesForce, but due to how we’ve frankensteined SalesForce we can’t sync, I promise I’ve researched the heck out of this, even selective sync can’t help, we’re making SalesForce do way too much and done too much data mangling.

Our implementer has created a native contact form for us which is great. First name, last name, email, city/state/zip, comments.

When the submit button is hit, in addition to submitting to HubSpot, we’d also like to hook our own code which will allow us to talk with our own API (which talks to our SalesForce).


  1. Is there an “onSubmit” or “postSubmit” event handler that I can hook my own code on to?
  2. Does is sound like I’m thinking about this the right way?


@caseywise is this a HubSpot form? Is the form embedded on your website or is the form on a page that is hosted by HubSpot?


Hi @pmanca, this is a native HubSpot form w/in our HS COS.


Doing some reading on WebHooks/Workflows, this seems like it’ll work. Ironing out passing the data collected on our contact form to POST.


@caseywise I think you are going down the right path. Let me know if you have any troubles on the workflows.


@pmanca, massively appreciate your input. I feel like I’m getting less dumber w/ HubSpot development, problem is more dumb still apparently needs shaken loose.


Workflow isn’t triggering when I expect it to.

“Contact Us Submission” workflow



Without exception, every time our “Contact Us” form is submitted, our workflow is triggered, the contents of that form get POSTed to our WebHook.


  • In my workflow history, I’m seeing: Contact was not enrolled because they already met the goal criteria and I expect to see Completed workflow
  • No history of the workflow triggering


:warning:WARNING The following may expose you to hillbilly ghetto hackery :warning:

  • Set WorkFlow starting criteria to a condition I’m certain doesn’t exist with the examples I’m submitting to our Contact Us form screenshot
  • Set WorkFlow goal to conditions I’m certain don’t exist in example “Contact Us” form submissions,screenshot


@caseywise Have you tried checking the box to allow contacts to be re-enrolled when they have re-met the criteria?

at the bottom of the entrance criteria click change re-enrollement options

then check off to allow that.


This page may help


@caseywise phema109 is right. Use that page, specifically onFormSubmit. If you need to handle the form submission elsewhere, you might be able to use jQuery to trigger the event you can read in from your own API integration. Something like $form.trigger('hubspot:form:submit') and then use jquery’s bind() to listen for that event and parse the data from the hubspot form in javascript. This is assuming you are using AJAX forms.