This article explains how to hide Dropdown questions from the response form if they have been filtered and no additional input is required by the end-user.
Prerequisites
|
What is the purpose of the Hide if no interaction checkbox?
When building smart templates, it might be necessary to filter Dropdown questions by other questions in order to narrow down the results displayed to the end-user. This may result in a single available answer in a filtered question. When there is only one option left on a Dropdown, you can hide this question to avoid prompting the end-users with a question that doesn't require any additional input.
How to hide a dropdown question if there is only one possible answer
When creating or editing a Dropdown question, the Hide if no interaction checkbox is visible in the Advanced options:
Important
|
Examples
Example 1 - First dropdown not required
In the example the Offices data source is used where the Country column has a reference to the Countries data source. Note that each country only has one office, except for the United States, which has two offices:
A template is created with a 'Country' and 'Office' dropdown question.
The 'Country' dropdown is linked to the Name column of the Countries data source:
The 'Office' dropdown is linked to the Name column of the Offices data source and filtered by the 'Country' dropdown (marked red). The options Hide if no interaction and Auto select first option are enabled:
Now when Preview form is clicked, note that by default the second dropdown 'Office' is shown with 'Office Berlin' selected, because there's no country selected in the 'Country' dropdown (this means the second dropdown is not filtered and the first option is selected).
If a country is selected in the 'Country' dropdown then the second dropdown 'Office' is only shown when the country is 'United States'. In all other cases the second dropdown is not shown, as no interaction is needed, because the other countries only have one office which is automatically selected:
Example 2 - First dropdown required
When using filtered dropdowns, Templafy behaves differently when the first dropdown is a required field.
If you use the template from example 1 and make the 'Country' dropdown required then this is the result:
Now by default the second dropdown 'Office' is not shown. It only becomes visible when a country is selected that has more than one office ('United States'). In that case the first option is selected ('Office Los Angeles') and the list shows the offices that apply ('Office Los Angeles' and 'Office New York').
NoteThe message Field is required is only shown when the value of a required field is deleted. By default the message is not shown. |
TipIf you have a data source with many records (rows) and use filtered dropdowns, making the first dropdown required will improve the performance of the template (shorter loading time of questions in the Composer). |
Overview
The table below shows the results of the second dropdown 'Office', depending on whether the first dropdown 'Country' is required, and if Hide if no interaction and/or Auto select first option for the 'Office' dropdown is/are enabled.
Country - Required |
Office - Hide if no interaction |
Office - |
Office - Result |
---|---|---|---|
Visible + enabled. The list shows all offices (or specific office(s) when a country is selected). |
|||
✔ |
Visible + greyed out. Becomes enabled when a country is selected. The list then shows specific office(s). |
||
✔ | Visible + enabled. The list shows all offices (or specific office(s) when a country is selected). | ||
✔ | ✔ | Not visible. Becomes visible + enabled when a country is selected. The list then shows specific office(s). | |
✔ | Visible + enabled (shows 'Office Berlin'). The list shows all offices (or specific office(s) when a country is selected). | ||
✔ | ✔ | Visible + greyed out. Becomes enabled (and shows the first office name) when a country is selected. The list then shows specific office(s). | |
✔ | ✔ | Visible + enabled (shows 'Office Berlin'). The list shows all offices. When a country is selected that only has one office, then the 'Office' dropdown is not visible. When a country is selected that has more than one office, the first office name is selected and the list shows specific offices. | |
✔ | ✔ | ✔ | Not visible. Becomes visible + enabled when a country is selected that has more than one office. In that case the first office name is selected and the list shows specific offices. |
Comments
Article is closed for comments.