### [Using Conditional Logic](https://wpforms.com/docs/how-to-use-conditional-logic-with-wpforms/)

**Published:** November 12, 2023
**Author:** Umair Majeed

**Excerpt:** Learn how to change how your form behaves based on your visitors' selections.

**Content:**

Conditional Logic is a Basic Feature

 Unlock Conditional Logic and other powerful features to grow your business.

 [ Get WPForms Basic ](https://wpforms.com/pricing/) 

Would you like to change how your form behaves based on what the user selects or enters into a field? [Conditional logic](https://wpforms.com/features/conditional-logic/) allows you to change what the user sees in your forms, what notification email gets sent out, and more.

This tutorial will introduce you to conditional logic in WPForms.

- [Basic Conditional Logic](#basic)
- [Complex Conditional Logic](#complex)
- [More Examples](#examples)
- [Frequently Asked Questions](#faq)

---

Before getting started, you’ll first need to make sure WPForms is [installed and activated](https://wpforms.com/docs/install-wpforms-plugin/) on your WordPress site and that you’ve [verified your license](https://wpforms.com/docs/verify-wpforms-license/). Then you can [create a new form](https://wpforms.com/docs/creating-first-form/) or edit an existing one to access the form builder.

## Basic Conditional Logic

The most common use of conditional logic is to show or hide fields depending on a user’s selection. For this example, we’ll make a single field appear when the user selects a specific option from a Dropdown field.

Let’s get started by opening the form builder. From there, click on the form field you want to show or hide. This will open its **Field Options** panel.

You’ll see a Smart Logic tab when you open the Field Options panel. Go ahead and click this to open it, then select **Enable Conditional Logic**.

![Enable conditional logic for a field](https://wpforms.com/wp-content/uploads/2021/07/Enable-conditional-logic-for-a-field.png)Now that conditional logic has been enabled, you should see a few dropdowns to set your condition rule. Here are the questions you’ll need to consider when filling in these dropdowns:

- **Show/Hide**: Would you like this logic to cause the field to be shown or hidden when conditions are met?
- **Select Field**: Which field would you like this logic to depend on?
- **Comparison**: What comparison would you 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**.

![Conditional logic options in WPForms](https://wpforms.com/wp-content/uploads/2021/07/Conditional-logic-options-in-WPForms-2.png)**Note:** Conditional logic comparisons are not case-sensitive.

- **Select Choice**: What value would you like the field to contain for this condition to apply? This field will deactivate if you select **empty** or **not empty** from the comparison dropdown.

Go ahead and fill out each of these dropdowns. For our example, we’ll apply conditional logic to our Other Business Type field. We’ll set the logic to say: **Show** this field if the **Business Type** dropdown **is** set to **Other**.

![Basic conditional logic example](https://wpforms.com/wp-content/uploads/2021/07/Basic-conditional-logic-example.png)Now, when a user selects the Other option in this field, the Other Business Type field will display. Otherwise, the extra field will remain hidden.

Please enable JavaScript in your browser to complete this form.

##### Try this Form Demo!

Email \*

Business Type \*RetailFood ServiceOther

Other Business Type \*

Request \*

Submit![Loading](https://wpforms.com/wp-content/plugins/wpforms/assets/images/submit-spin.svg)

 Check out our [Cake Order Form Template](https://wpforms.com/templates/simple-cake-order-form-template/ "Cake Order Form Template"), which uses conditional logic to display fields based on user selection.

## Complex Conditional Logic

You may find that a single conditional logic rule isn’t complex enough for some situations. However, it’s possible to add as many conditions as you’d like.

**Note:** When adding multiple conditions, be careful that they don’t conflict with one another. It’s always a good idea to [test your form](https://wpforms.com/docs/how-to-properly-test-your-wordpress-forms-before-launching-checklist/ "How to Properly Test Your WordPress Forms Before Launching [Checklist]") before adding to a live page or post.

For example, we’ll ask users if they’d like to subscribe to our Retail Marketing newsletter. However, we only want to display this option if they’ve shared an email address and chosen Retail as their Business Type.

To set this up, we’ll first add a **Checkboxes** field to our form. Then, we’ll customize the field label and options to fit our needs.

![Set up a field before applying conditional logic](https://wpforms.com/wp-content/uploads/2021/07/Set-up-a-field-before-applying-conditional-logic-1.png)Next, we’ll repeat the process from the section above to enable conditional logic and add our 1st rule. This rule will state: **Show** this field if **Email** is **not empty**.

![Set up first conditional logic rule](https://wpforms.com/wp-content/uploads/2021/07/Set-up-first-conditional-logic-rule-1.png)Now that we have the 1st condition set, we need to decide whether to use [AND or OR conditional logic](https://wpforms.com/docs/how-to-use-and-or-conditional-logic/ "How to Use (AND – OR) Smart Conditional Logic in WPForms") for the 2nd condition.

For our example, we want the checkbox to display if the user enters an email and chooses Retail, so we’ll click the **AND** button to add AND logic.

![Add AND logic to field](https://wpforms.com/wp-content/uploads/2021/07/Add-AND-logic-to-field.png)**Note:** The **Add New Group** button lets you add an additional logic to execute the command if the first condition isn’t met. For more details on both AND and OR conditional logic, be sure to check out our [video](https://www.youtube.com/watch?v=RNSwMHAhQrE "How to Use AND OR Conditions with Conditional Logic in WPForms") and [tutorial](https://wpforms.com/docs/how-to-use-and-or-conditional-logic/ "How to Use (AND – OR) Smart Conditional Logic in WPForms").

Now we need to set up our 2nd rule and save the form. With our AND logic in place, our checkbox field will only display if both conditions are met.

#### Choosing Individual Matches From Multivalued Fields

Conditional logic does not search multivalued fields for individual matches. You’ll need additional rules to exclude the values you don’t want to be matched.

In this example, we’ll show you how to display a new Multiple Choice field with frequency options when the user only selects Offers and Sales.

![Multichoice form for conditional logic](https://wpforms.com/wp-content/uploads/2018/06/multichoice-form-for-conditional-logic.png)To achieve this result, we need to add 3 conditional logic rules for the Multiple Choice field we intend to show.

First, we’ll set the field to **Show** if the option Offers and Sales is selected.

![The first rule in place](https://wpforms.com/wp-content/uploads/2022/06/multichoice-form-for-conditional-logic-single-rule.png)Next, we need 2 additional rules that tell our form to exclude the first 2 options from our conditional logic. For each rule, we’ll use the checkbox field from our example.

![Select the field to pull conditions from](https://wpforms.com/wp-content/uploads/2022/06/select-conditional-field.png)Next, we’ll set the **Select Choice** to **Company Updates** for the 1st rule and **New Products** for the 2nd. For the **comparison** in each rule, we’ll use **is not**.

![Set the comparison to is not](https://wpforms.com/wp-content/uploads/2022/06/multichoice-form-for-conditional-logic-is-not-rules.png)**Note:** If any multiple choice (Dropdown, Checkboxes, or Multiple Choice) field is used as the parameter, only the **is**, **is not**, **empty**, and **not empty** options will be available.

With these rules in place, the Multiple Choice field will only be available if only **Offers and Sales** is selected.

![Showing the field when the condition is met](https://wpforms.com/wp-content/uploads/2018/06/condition-met-multivalue-field.png)It won’t show when Company Updates or New Products are selected.

![All choices selected](https://wpforms.com/wp-content/uploads/2018/06/multichoice-form-for-conditional-logic-all-choices-selected.png)## More Examples

There are so many ways to use conditional logic in your forms that it would be hard to cover them all in a single tutorial. Instead, we’ve shared detailed examples in many other docs and blog posts.

Below is a list linking to some of our most popular tutorials showing examples of how to use conditional logic in WPForms:

- General Instructions/Inspiration 
    - [Add Multiple Conditions with AND – OR Logic](https://wpforms.com/docs/how-to-use-and-or-conditional-logic/ "How to Use (AND – OR) Smart Conditional Logic in WPForms")
- Examples for Specific Goals 
    - [Conditional Form Notification Emails](https://wpforms.com/docs/how-to-create-conditional-form-notifications-in-wpforms/ "How to Create Conditional Form Notification Emails in WPForms")
    - [Conditional Form Confirmations](https://wpforms.com/docs/how-to-create-conditional-form-confirmations/ "How to Create Conditional Form Confirmations")
    - [Let Users Choose a Payment Method](https://wpforms.com/docs/how-to-allow-users-to-choose-a-payment-method-on-your-form/ "How to Allow Users to Choose a Payment Method on Your Form")
- Examples for Email Marketing Integrations 
    - [AWeber Signup Checkbox](https://wpforms.com/how-to-add-an-aweber-signup-checkbox-to-your-contact-form/ "How to Add an AWeber Signup Checkbox to Your Contact Form")
    - [Constant Contact Signup Checkbox](https://wpforms.com/how-to-add-a-constant-contact-signup-checkbox-to-a-wordpress-form/ "How to Add a Constant Contact Signup Checkbox to a WordPress Form")
    - [GetResponse Signup Checkbox](https://wpforms.com/how-to-add-a-getresponse-signup-checkbox-to-your-contact-form/ "How to Add a GetResponse Signup Checkbox to Your Contact Form")
    - [Mailchimp Signup Checkbox](https://wpforms.com/how-to-add-a-mailchimp-signup-checkbox-to-your-contact-form/ "How to Add a MailChimp Signup Checkbox to Your Contact Form")
    - [Let Users Pick a Mailchimp List](https://wpforms.com/how-to-let-users-pick-a-mailchimp-list-in-your-wordpress-form/ "How to Let Users Pick a MailChimp List in Your WordPress Form")
    - [Let Users Select Mailchimp Groups](https://wpforms.com/how-to-allow-users-to-select-mailchimp-groups-in-your-wordpress-form/ "How to Allow Users to Select MailChimp Groups in Your WordPress Form")

## Frequently Asked Questions

These are answers to some top questions about using Conditional Logic in WPForms.

#### Which form fields can be used when setting up conditional logic to hide/display other fields?

Below is a list of the fields that can be used with conditional logic:

- Single Line Text
- Paragraph Text
- Number Slider
- Dropdown
- Multiple Choice
- Email
- Website / URL
- Checkboxes
- Numbers
- Multiple Items
- Checkbox Items
- Dropdown Items
- Hidden Field
- Rating
- Net Promoter Score

That’s it! We hope this article helped you learn how to use conditional logic with WPForms.

Next, would you like to learn about the available field types in WPForms? Be sure to check our complete guide to [WPForms standard fields](https://wpforms.com/docs/how-to-choose-the-right-form-field-for-your-forms/ "WPForms standard fields") for more details.

**Categories:** Functionality, Form Creation

---

