Do Pardot Forms provide an onSuccess handler? I am trying to write custom JavaScript that submits the form data to an external API only if the form is valid.

The only success I have had is adding custom JS to the Form Layout Template, but this requires me to write my own validation which seems redundant.

Thanks in advance!

2 Answers 2


To our knowledge there isn't anything like you are looking for. The various validations we've implemented have all followed the same approach as you, where we add custom JS to the Form (or Form Layout Template) and handle it there.


Pardot has a form handler feature that you may be able to leverage for your needs. I used this for an org with a Web2Lead form on their website. They wanted everything to hit Pardot first and then also be sent to Sales Cloud. We were able to get this set up fairly quickly and easily. There's also some material on Trailhead module you might find helpful; the link is below. It's been a bit since I set it up, but what I remember is this:

  1. In Pardot, set up the form handler as necessary. You can opt to forward the original success message on to another destination. Once complete, Pardot will give you the URL for the next step.
  2. On the html form, you'll change the onSuccess or Submit action parameter to submit to the URL provided in the previous step.

Trailhead: Use Pardot Forms and Form Handlers

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .