Conditional logic means executing an action only if a condition is met, for example when the user select and option or fill the form in a certain way. There are many features that support conditional logic for example:
- Showing/Hiding fields
- Custom Validations
- Redirecting the user to a page after submission
The conditional logic builder has 3 main sections :
1: Select the field that you want to compare
2: Select the comparison type (like “Equal To” or “Greater Than”)
3: Select the value that you want to compare
In the example below the condition is checking if the email field has the value “firstname.lastname@example.org”
Creating comparisons with multiple fields
You can also execute comparisons with multiple fields, there are two types of multiple comparisons.
In the “And” comparison all the comparisons that you add should be met. For example, in the screenshot below the conditional logic will be executed only if the Email is “email@example.com” AND the Checkbox field has the “Option 2” selected.
If for example email is “firstname.lastname@example.org” but the checkbox field doesn’t has the “Option 2” selected then the conditional logic is not executed because it doesn’t meet the two conditions.
To create the “And” comparisons click on the “And” button
In the “Or” comparisons the condition is going to be executed if at least one comparison is met. In the example below the conditional logic is going to be executed if the Email is email@example.com OR Checkbox has “Option 2” selected.
If both conditions are met (Email is firstname.lastname@example.org and Checkbox has the “Option 2” selected) the condition is also going to be executed because the only requirement to execute an “Or” condition is that at least one condition is met.
To create “Or” conditions click on the “Add new group” button
You might also want to use the value of another field to do a comparison, for example, you might want to my sure that the user inputs the email correctly and for that, you might want to add an “Email” and “Confirm Email” field and make sure they both match. You can do this using formulas like this:
1.- In your condition click on the calculator icon to create a formula
2.- Set up the formula that you want to use, in this case, you just want to return the “Confirm email” field as you just want to compare that both emails match but if needed you could do more advanced stuff like arithmetical operations.
3.- That’s it! now your custom validation will verify that both fields match and if not it will throw an error message to your users
This is how your condition should look:
and this is the result:
About the Author:Im programmer working for an international company. I have programmed since i was 12 and i have done it professionally for 6 years. Programming for a company is fun and i have learned a lot of things but i have always been interested in running my own business so i decided to give it a shot doing what i do best, programming stuffs.