How to Implement Conditional Logic on WordPress Forms

Would you like to show/hide form fields depending on user answers?
Conditional logic of the WordPress Form Maker plugin allows you to create smart, user-friendly forms with complex logic.
You can show the user only what they need to see and keep the forms short and straightforward.
In other words, depending on the options they choose, the users see only those fields that are related to their chosen values. Employing conditional logic renders significantly more simple and comprehensible forms.
Keep in mind, however, that conditional logic works only on the premium version of this plugin. If it’s something you will use on your site often, you can read up on the pricing scheme, conditions, and additional functionality on our site.
Creating forms using conditional logic
Let’s get started by creating the form with the WordPress Form Maker. From the submenu of the plugin go to the
> Forms page,
> choose an already-created form or create a new one by following the steps in this guide.
Note: Make sure to add all necessary fields to your form.
> Navigate to “Form options” of your form,
> Click on the “Conditional fields” tab.
Press ”Add Condition” button to configure the first condition of your form. The options to configure the conditional logic will appear.
Let’s go through all of them one by one:
1. Set the action of the condition to: Show or Hide,
2. Choose the field to which that action will refer to,
3. Choose in which case the condition should occur: if all or if any of the selections match.
Click the little Plus (+) icon to add the statement of your form condition.
- Select the field that you would like this logic to depend on.
- Select which logical comparison you would like to check:
- is,
- is not,
- like,
- not like,
- empty,
- not empty.
3. Select or fill in the value that the field should contain for the assigned condition to apply.
Now let’s consider two examples of conditional logic:
- Simple Conditional Logic;
- Complex Conditional Logic (applying conditional logic to a field with its own conditional logic).
Simple Conditional Logic
Let’s consider the case when you are asking the user to choose the means of communication after they contact your team.
The condition you configure needs to have the following logic:
The user will see the field asking for his or her email/phone number only if he or she chooses email/phone as a preferred method of communication.
Go ahead and set up the first condition for emails:
[Show] [Email field] if [all] of the following match:
[Means of communication] is [Email]
and then add the second condition to show the phone field:
[Show] [Phone field] if [all] of the following match:
[“Means of communication”] is [Phone]
Complex Conditional Logic
For instance, you want to show the field “Means of communication” (with its own conditional logic that we have created in the section “Simple Conditional Logic”) if the age of the user is 25 and he/she lives in Tokyo. Let’s also assign the form to show the reason for rejection in case the conditions are not fulfilled.
The conditions you configure need to have the following logic.
Condition 1: (the user lives in Tokyo and is 25 years old)
[Show] [“Means of communication” ] if [all] of the following match:
[Age] is [25]
[City] is [Tokyo]
Condition 2: (If the above statement is true, hide the Reason)
[Hide] [Reason] if [all] of the following match:
[Age] is [25]
[City] is [Tokyo]
Condition 3: (If the user lives in Tokyo and is 25 years old, we need to receive contact info)
[Show] [Email field] if [all] of the following match:
[Means of communication] is [Email]
and add the second condition to show the phone field:
[Show] [Phone field] if [all] of the following match:
[Means of communication] is [Phone]
Congrats! We have just created a form with complex conditional logic.
You can check out other user-friendly and advanced functionalities of this WordPress form builder plugin here or learn how to create a donation form on WordPress. Do write below if you run into any difficulties, and we’ll promptly help you out!
Don't forget to share this post!
How to Manage Form Submissions on WordPress
This is a comprehensive tutorial on managing the form submissions you get on your WordPress site.
What Can I Get from 10Web?
Get to know the 10 components of 10Web and the list of the main benefits you’ll get with the company.
How to Configure Form Confirmations and Notifications on WordPress
Web forms are an essential part of most websites. Configuring their confirmations and notifications will let you monitor the stats of the replies, drop a thank-you note or send out an automated email in an attempt to “humanize” your site. The initial step is installing and activating Form Maker plugin. Here’s a beginner’s guide on how to do it. In this step-by-step tutorial, you will learn how to configure the “communicativeness” of the contact form we created in a previous tutorial using WordPress Form Maker plugin. But these instructions will work on any form really. Configuring Form Confirmations and Notifications A form confirmation is what your website visitor sees after they submit the form. It could be a thank-you message or a redirection to a relevant page. Alternatively, you could choose not to have one, keeping the users on the form page. After clicking the left menu’s Form Maker, picking the form, and pressing Form…