Checkboxes on pardot custom form handler aren’t saving. Are you using php? Did you forget the []?

So you’ve built a spiffy custom form and are trying to make use of the really cool feature of pardot where checkbox values can cause a prospect to be added to newsletters without using precious automations only its not saving your data OR its only saving one entry.

I am writing this post because when searching for this answer I litterally found nothing about this specific gotcha when using pardot with a php client.

Lets start by establishing a new custom prospect field (Admin -> Configure Fields -> Prospect Fields)

When creating your multi-select or checkbox HTML, you’ll need the “value” info each label. In this example; that’s “social-studies-newsletter-dynamic” and “leadership-newsletter”
These will be the values of your multi-select options or checkboxes.

So lets build a custom form handler to make use of our new custom prospect field.
(Marketing -> Forms -> Custom Form Handlers)

Lets click the edit button on that newsletters field.

That external field name… that is exactly what should appear in your custom HTML form. Exactly.

<html>
    <body>
        <form action="https://pardot.example.test/l/999999/2022-02-04/99wtfm" method="post">
            <label>Email
                <input name="email" type="text" value=""/>
            </label>
            <label>social-studies-newsletter-dynamic
                <input name="newsletters[]" type="checkbox" value="social-studies-newsletter-dynamic"/>
            </label>
            <label>leadership-newsletter
              <input name="newsletters[]" type="checkbox" value="leadership-newsletter"/>
            </label>
            <input type="submit" />
        </form>
    </body>
</html>

The most important thing on this page is the [] at the end of the field name. This is what allows your browser to send more than one value for a given selection. If you by chance made a field of type checkbox or multiselect and didn’t NAME the form field correctly, you won’t get all the selected options.

This is absolutly bat shit crazy to expect marketing folks to pick up on this menuta of implementing a custom HTML form. It doesn’t appear to be documented anywhere in salesforces epic amount of documentation and it really pissed this person off too.
Saddly Polymath didn’t write that post on checkboxes.

To be clear, [] for arrays is a php thing.

Hopefully this solved your problem.

2 thoughts on “Checkboxes on pardot custom form handler aren’t saving. Are you using php? Did you forget the []?

  1. I stumbled across this issue this week as well and it’s absolutely ridiculous.

    I would like to add that adding [] to the field name is only required because that’s how data comes from the client. In my case I process the form on the backend of our application and then forward on the data via another post request. What I’ve found is that you can name the field whatever you want so long as it’s Form URL-Encoded. If you were to use something like Postman you could just send through multiple newsletter=&newsletter=… params without an issue.

    • The [] notation thing is definitely a php thing.
      In my case, a php form builder is sending the data on to pardot so that’s why it was requiring it.
      It’s kind of a pain to register to post a comment so that must have really cheesed you.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.