How to Create a Conditional Logic Form in WordPress

Want to make a conditional logic form easily? Conditional logic is a smart way to make your form clutter-free and modern, so you can get even more conversions.

So in this post, we’ll walk you through, step-by-step, exactly how to create a form with a conditional logic form in WordPress.

Click Here to Make Your Conditional Logic Form

Here’s a table of contents to help you navigate this tutorial on building a form with conditions:

WPForms is the best WordPress Form Builder plugin. Get it for free!
  1. Generate a Simple Contact Form
  2. Add Conditional Logic
  3. Configure Your Form Settings
  4. Configure Your Form Notifications
  5. Customize Your Form Confirmations
  6. Add Your Conditional Logic Form to Your Site

What Does Conditional Logic Mean?

Basically, Conditional Logic lets you show and hide fields based on your site visitors’ previous answer on your form.

There are endless ways to use conditional logic to make dynamic forms, and we’ll let you know some of the ways you can benefit from using it next.

Why Use Conditional Logic on Forms?

Asking yourself why and when to use conditional logic on your WordPress forms? There are lots of great ways to use smart conditional logic to make your forms even more effective.

  • Create Forms That Aren’t Cluttered— If someone doesn’t need to be asked something, you can hide a form field unless they respond a certain way. Then, the field will appear, keeping your forms nice and tidy, preventing long forms, and helping reduce form abandonment.
  • Get More Details on Surveys — Show or hide different types of questions in paragraph text based on user ratings or with Likert scales. This is a great way to find out more about why people feel the way they do.
  • Offer Multiple Payment Options — Why decide between using Stripe or PayPal on your order forms when you can use both? This offers your customers more options to pay.
  • Use a Discount Field — Give users the option to enter a coupon code field to save money on their order. But, only show it if they say they have one.
  • Many, many more reasons…

So now that you know why you might want to use conditional logic on your website’s forms, let’s check out exactly how to add it.

How to Create a Conditional Logic Form in WordPress

If you want to add conditional logic to your WordPress forms, here’s exactly how to do it easily:

Step 1: Generate a Simple Contact Form

The first thing you’ll need to do is install and activate the WPForms plugin. For more details, see this step-by-step guide on how to install a plugin in WordPress.

Next, go to WPForms » Add New to create a new form.

On this screen, select the Simple Contact Form template.

select simple contact form template to create range slider

Next, the simple contact form template will generate for you. Pretty awesome, right?

simple contact form template before range slider

Let’s go ahead and remove the Comment or Message box by clicking on it and then clicking on the red trash icon in the top right corner.

delete a field in wpforms

Great job — now let’s get to the fun part. Adding Conditional Logic.

Step 2: Add Conditional Logic

Now let’s go ahead and add some simple conditional logic to your form.

First, add a Multiple Choice field to your form by dragging it from the left-hand panel onto your form on the right.

add multiple choice field to conditional logic form

Now, click on the field to open its settings on the left-hand panel. You can edit the Label and the choices here.

change label on multiple choice field for conditional logic form

Now, pick a field that you want to display based on a previous answer from the Add Fields panel and drag it onto your form.

add single line text field to your conditional logic form

In this example, we’ll have a Single Line Text field appear after someone checks ‘Other’ on a multiple choice question.

add single line text field to create conditional logic form

Click on the Single Line Text field to edit it’s label. In our example, we asked for more details on what ‘Other’ is.

change field label wpforms

Now, you’ll want to enable Conditional Logic for this field by clicking on the Conditionals dropdown on the left-hand panel and click on the checkbox next to Enable Conditional Logic.

enable conditional logic on form

Next, enter the following info in the conditional settings: Show this field if ‘Where Did You Hear About Us?‘ is Other, as pictured below.

set up conditional logic for single line text field (1)

It really is that simple!

You can do all sorts of things under this area like:

  • Show/Hide: The field will be shown or hidden when conditions are met (what we are using in this tutorial)
  • Select Field: The field that you would like this logic to depend on
  • Comparison: The comparison you would like to use on this field. Options include: is, is not, empty, not empty, contains, does not contain, starts with, ends with, greater than, and less than.

Want to get advanced with your forms? Check out our documentation with steps for making more complex conditional logic.

Lastly, you can add any additional fields to your conditional logic form by dragging them from the left-hand side to the right-hand side.

When you’re done customizing your form, click Save in the top right corner.

form with enabled conditional logic

Step 3: Configure Your Form Settings

Now, go to Settings » General.

conditional logic form settings

Here you can configure the following:

  • Form Name — Change the name of your form here if you’d like.
  • Form Description — Give your form a description.
  • Submit Button Text — Customize the copy on the submit button.
  • Spam Prevention — Stop contact form spam with the honeypot feature or Google reCAPTCHA. The honeypot feature is automatically enabled on all WordPress forms so if you decide to use another form of spam prevention, unclick this option.
  • AJAX Forms — Enable AJAX settings with no page reload.
  • GDPR Enhancements — You can disable the storing of entry information and user details, such as IP addresses and user agents, in an effort to comply with GDPR requirements. In addition, check out our step-by-step instructions on how to add a GDPR agreement field to your simple contact form.

When you’re done, click Save.

Step 4: Configure Your Form Notifications

When someone fills out the form on your website, it’s important you and your team are notified right away.

Notifications are a great way to send an email whenever a form is submitted on your website.

conditional logic form notification settings

If you create smart tags, you can also send notification emails to users when they fill this out, letting them know you received their form submission. This assures people their request has gone through.

For help with this step, check out our documentation on how to set up form notifications in WordPress.

And if you want to keep branding across your emails consistent, you can check out this guide on adding a custom header to your email template.

Custom Email Header

This is a great way to quickly get form entries to yourself or your team to make sure they jump on things quickly!

Step 5: Customize Your Form Confirmations

Form confirmations are messages that display to site visitors once they submit a conditional logic form on your website. They let people know that their request has gone through and offer you the chance to let them know what the next steps are.

WPForms has 3 confirmation types to choose from:

  1. Message — This is the default confirmation type in WPForms. When a site visitor submits a request, a simple message confirmation will appear letting them know their form was processed. Check out some great success messages to help boost user happiness.
  2. Show Page — This confirmation type will take site visitors to a specific web page on your site thanking them for submitting their info. For help doing this, check out our tutorial on redirecting customers to a thank you page. In addition, be sure to read our article on creating effective Thank You pages.
  3. Go to URL (Redirect) — This option is for when you want to send site visitors to a different website.

Let’s see how to set up a simple form confirmation in WPForms so you can customize the message site visitors will see when they fill out your conditional logic form.

To start, click on the Confirmation tab in the Form Editor under Settings. Next, select the type of confirmation you’d like to create. For this example, we’ll select Message.

message confirmation type on conditional logic form

Then, customize the confirmation message to your liking and click Save.

For help with other confirmation types, see our documentation on setting up form confirmations.

Step 6: Add Your Conditional Logic Form to Your Site

After you’ve created your form, you need to add it to your WordPress website. WPForms allows you to add your forms to many locations on your website, including your blog posts, pages, and even sidebar widgets.

Let’s take a look at the most common placement option: page/post embedding.

To begin, create a new page or post in WordPress, or go to the update settings on an existing one.

After that, click inside the first block (the blank area below your page title) and click on the Plus icon.

adding conditional logic form to website

From the different blocks, find and Select WPForms.

select wpforms from block

Now, the handy WPForms widget will appear inside of your block. Click on the WPForms dropdown and pick which one of the forms you’ve already created that you want to insert into your page.

select your conditional logic form

Select your Conditional Logic Form from the dropdown. Then, publish or update your post or page so your form will appear on your website.

publish conditional logic form page on wordpress

Want to view form entries after they’ve been submitted? Check out this complete guide to form entries. For example, you can view, search for, filter, print, and delete any form entries.

Click Here to Make Your Conditional Logic Form

Final Thoughts

So there it is! You now know how to create a conditional logic form in WordPress using the WPForms plugin.

Want to learn what your website visitors are thinking? Head over to this post with NPS Survey examples to see how easy it is to put a survey on your site and gather valuable feedback.

So what are you waiting for? Get started with the most powerful WordPress form builder plugin today.

And don’t forget, if you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Using WordPress and want to get WPForms for free?

Enter the URL to your WordPress website to install.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.