How to conditionally show/hide questions in a form?
Last updated July 14, 2024
You can now use the display logic feature to conditionally show/hide questions in a form based on the recipient's previous responses.
For example, the first question of my form is-
Q. Which country do you live in?
A. India
B. USA
Now, there are two cases, the recipient can select India or USA as their answer. In both the cases, different subsequent questions will be shown to the recipient.
Case 1- If the email recipient selects India as their response, then this question will be shown to them-
Q. Where do you live in India?
A. Delhi
B. Bangalore
Case 2- If the email recipient selects USA as their response, then this question will be shown to them-
A. New York
B. Washington DC
In this example, the first question i.e Which country do you live in is the decision question. The decision question is the independent question the answer to which will determine whether subsequent questions are shown or not.
Where do you live in India and Where do you live in USA are show/hide questions. The show/hide questions are dependent questions. They will be show or hidden depending on the recipient's response to the decision question.
Decision question
A decision question can belong to the following question types-
Question type | |
1. | Single select (drop down) |
2. | Radio (single select) |
3. | Emoji |
4. | Thumbs up |
5. | Single select chip |
6. | Star |
7. | NPS |
Show/Hide question
A show hide question can belong to any of the following question types-
Question type | |
1. | Single select (drop down) |
2. | Radio (single select) |
3. | Emoji |
4. | Thumbs up |
5. | Single select chip |
6. | Star |
7. | NPS |
8. | Text input |
9. | Checkbox |
10. | Text* |
11. | Multi line |
12. | Date picker |
13. | Time picker |
14. | Phone number |
15. | Multi select chip |
How to configure display logic?
Step 1: Create a form with all the decision questions and show/hide questions. Learn more about using the editor here .
Step 2: Select the question you want to conditionally show or hide.
You will only be able to configure display logic if a decision question precedes a show/hide question.
First question of a form can never be a show/hide question since no decision question precedes it. The first question will always be shown.
Click on show/hide logic as shown in the screenshot above.
Step 3: Click on add condition and configure display logic.
a. In the first drop down, select whether you want to show or hide the question if the condition is met.
b. In the second dropdown, select the decision question (all decision questions preceding the selected question will be visible in the drop down).
c. In the third dropdown, select the conditional operator. In the case of single select dropdown, radio, thumbs up and single select chip the conditional operators would be Equals and Not equals.
In case of emoji, NPS and star rating, the conditional operators would be Less than, Less than or equals, Equals, More than or equals, More than and In-between.
d. In the fourth dropdown, select one of the decision question's answer options to complete the condition.
If you have selected Show this question in the first dropdown, then the question will only be shown if the condition is met. Otherwise, the question will be hidden.
If you have selected Hide this question in the first dropdown, then the question will only be hidden if the condition is met. Otherwise, the question will be shown.
Once you have configured the logic click on Save changes.
The decision question and show/hide question can belong to different steps in the form. As long as the decision question precedes the show/hide question, display logic will be honored.
You can use the same decision question for multiple show/hide questions.
You can use nesting to configure advanced logic i.e a show/hide question can be a decision question for another question. For example, in the example mentioned above, if the recipient selects Delhi as their place of residence, then we can ask them another question Where do you live in Delhi? This question will only be shown if they select Delhi as their place of residence (in India), else it will stay hidden.
Please note that nesting will only work if the show/hide question belongs to one of the following question types- single select dropdown, radio, single select chip, emoji, thumbs up/down, star rating, NPS.
Use display logic along with step logic to configure advanced logic.
Step 4: Check the preview and send a test email to make sure everything works as expected.
You are all set to use display logic in forms!
Additional Resources
If you have any queries, then reach out to us at Mailmodo Support or share your thoughts at Mailmodo Product Feedback.