9.3 Show elements based on user`s selection
A Single Select element may also be used to have the user select between various options and then showing or hiding elements based on that selection.
In this example we have two types of something, type A and type B. We can choose between A or B, or both. A grid called Name is invisible (hidden) at first. When A is chosen, grid row 1 will become visible. When B is chosen, grid row 2 will become visible. And you guessed it; when A and B is selected, both rows will show in the form. This is a ‘mixed’ logic we will set up in the form as follows:
In the grid Name, row 1 and 2 are both Disabled and Hidden in Element properties so the grid is hidden.
In the Preview panel the form looks like this when opened:
When A and B is selected, the form looks as follows:
We can use the following two rules (defined in the top Form element) to define the logic we need:
Left: If A or A and B is selected, display row 1.
Right: If B or A and B is selected, display row 2.
Note: In a case like this one may try to define 3 rules for each of the start options, one for A, one for B and one for A and B. If we only had two options, A or B, this logic works fine. When the options are mixed, we must use the logic displayed here. We then only need 2 rules, one for showing row 1 and one for showing row 2. This logic is based on the result, not the start options.