How to Add Toggles to Your Pardot Email Preferences Page

Looking for a way to spice up your Pardot email preferences page? Try using toggles instead of checkboxes. In this tutorial, I’ll show you how to create a preferences page that uses toggles instead of checkboxes. With a bit of HTML and some CSS, you can transform your preferences page in four easy steps.

Demo

Here’s an example of what we’ll be creating in this tutorial.

See the Pen Pardot Preferences Page With Toggles by Jenna Molby (@jennamolby) on CodePen.

Step 1: Style your preference page

This post does not cover the basics of styling your Pardot preferences page. Click here to learn how to customize your page from scratch.

Step 2: Update the preferences page template

To make the toggles work, you will need to edit the form section of your layout template. Navigate to the layout template and click on the form tab. Replace the content with this HTML.

What’s changed?

  1. Instead of placing the form fields in a paragraph, the form fields are placed in an ordered list with a class named “switches”.
  2. Some jQuery is added to update the HTML markup of the preferences form.

Step 3: Upload icons into Pardot

There are two icons that will need to be uploaded in Pardot, a checkmark icon and a “x” icon. Download the images and then upload the images into the content library within Pardot.

Step 4: Add the CSS for the toggles

Add this CSS to your layout template. Update the first couple of lines to include the image paths to the icons you uploaded in step 4.

Now your page would look something like this, with the checkboxes turned into toggles.

Optional: Add any additional CSS

I added some additional CSS to my page to style the labels, list descriptions and options for my page. Here’s the CSS I added.

The final result

Here’s what my final page looks like.

See the Pen Pardot Preferences Page With Toggles by Jenna Molby (@jennamolby) on CodePen.

Questions?

Send me a tweet @jennamolby, or leave a comment.



Special thanks to Tuts+ for a great tutorial on CSS toggles. This tutorial was the inspiration for building this within Pardot.