How to Conditionally Show and Hide Form Elements
To evaluate if a checkbox question contains one or more specific values the array must be evaluated for the values. The indexOf method is used to determine if the value(s) are in the array.
The indexOf method returns the location in the array where the string is found. For example if the string is found in the first element of the array 0 is returned. If the string is found in the 3rd element 2 is returned. If it is not found -1 is returned. Therefore if any value greater than or equal (>=) 0 is returned, the string is found in the array.
The logic will be appled to the "Visible" property of the question to be conditionally displayed and hidden. In the example below the text question will be diplayed if the checkbox question is "a" or "c".
Checking for multiple values
Logic can be used to check for value1 AND value2. Logic can also be used to check for value1 OR value2
values('Checkbox Question').indexOf("a")>=0 && values('Checkbox Question').indexOf("c")>=0
values('Checkbox Question').indexOf("a")>=0 || values('Checkbox Question').indexOf("c")>=0
Updated about 1 month ago