One of the most powerful features of the forms module of Divi is the conditional logic that allows to show or hide form fields depending on whether certain conditions are met so let's see how easy it is to use them.
How conditional logic works
The first thing is to know the characteristic, that you will find in each field of your form.
As you see in the previous capture, the first thing is to activate the conditional logic .
Once done this it decides if the rules (more below) what you apply will be all at once or any of them . This is a vital decision for the operation of logic, and the best teacher is the practice and purpose of your form.
To finish, start applying rules about existing fields, and this already gives you a clue: you can not apply conditional logic until you have created all the possible fields of your form .
Operation is simple :
- You choose the field to which the rule will apply between created
- Defines the conditional logic:
- is equal to (an option of your chosen field)
- is not equal to (idem)
- is greater than (a numerical value of the chosen field)
- ] is less than (idem)
- contains (text, etc. of the chosen field)
- does not contain (idem)
- is empty (the chosen field)
- is not empty (idem)
- You select the value to which the conditional logic will be applied between the values of the chosen field.
] The result is that the field to which you apply the conditional logic will only be seen if the rule or rules defined is met, otherwise it will not be displayed.
The best way to see it it is with examples, so we are going to entangle a little with some representatives.
The field offers options
If the field to which you are going to apply the conditional logic is of the drop-down type, checkboxes or radio buttons is almost the most obvious, you just have to choose the conditional logic (equals, is not equal, etc) and choose the field to the value of the available options to which it will be applied .
So, if the field we are editing is of type checkboxes and you have defined that the rule is that you have chosen the field " I want … " the option " Budget Request ", then this field will be displayed .
And in the published form, choosing the option " Budget " will show the field of budget types to which we have applied the conditional logic in addition to all generic fields, with no conditional logic, common to say it in some way.
As you see in the previous example, before selecting a field from the first drop-down are shown the fields without conditional logic (name, email, message) and are only selected by selecting the field with conditional logic, so that – in this case – the client chooses the budget type.
No is an options field
The other broad possibility is when the field from which the logic will emerge is not a list of options but something else plan or.
Imagine, for example, that there is a field for the user to I saw a resume, and if the user chooses it, an additional field is shown to explain its virtues.
You could also add a field whereby if the email address is from the company itself, it will not be shown, since You have your skills. Something like that …
In this way, even if the user selects the value " Work with you ", as I have marked apply all the rules, it will only be shown if the mail does not contain ayudawp.com.
As you see in the screenshots, if you do not enter the email, the aptitude field for the job is shown, but once the enter and match the condition put that field is hidden.
The examples can be many, and you can complicate the form to infinity, applying rules on rules to create really complex forms, with a lot of answers based on varied conditional logics.
This makes the forms module of Divi really powerful, for almost any need. For my taste just lacking a file upload field, otherwise, thanks to the conditional logic, is practically perfect.