If you want something to show only when a certain number of checkboxes have been checked follow the instructions below:
1. Drag over a checkbox field and fill out the form, the “Field Name will be what the value of the checkbox (which is 1 when checked) is stored in, with “Text” just being what will be displayed in the Checkbox.
2. Now add a “Label Field” to your form, and fill it out as below. To make life a lot easier and error free, just copy and edit the text here and insert into the “Text” section of this field:
{{ ([ values.codeCheck1, values.codeCheck2, values.codeCheck3 ] | filter:true).length }}
-replace the bolded values above for each “Field Name” you have in your Checkbox Field, so if you have more than three, just type in more by doing: values.fieldName and putting commas between each variable.
3. Next, add another “Label Field”, this one will be what you have pop-up after you set the condition. This actually does not have to be a “Label Field”, it could be almost any “Field”, as long as there is “Visibility Condition” section of the field for you to add in your checkbox condition.
-For this example, I just used a “Label Field” and have text show up when the “Visibility Condition” is met. You can copy the format of this code again for ease. Note at the end of the length of this code is the condition that needs to be met, once this condition is met then the field (in this case just the text) will show up in the form. The code below just requires more than 1 of the checkboxes to be selected.
([ values.codeCheck1, values.codeCheck2, values.codeCheck3 ] | filter:true).length > 1
The end result for this example once the condition is met, looks like this:
4. If you have multiple conditions that need to be met, as in you have multiple checkboxes that need to be selected. Follow these notes for help:
- for greater/less than or equal to a value use:
xxxx).length>= 1 or xxxx).length<=1
- for just equal to a value use: xxx).length == 1
- for does not equal use xxx).length != 1
- when you have multiple conditions that both must be met use && in between the conditions as shown:
((([ values.codeCheck1, values.codeCheck2, values.codeCheck3 ] | filter:true).length > 1) && (([ values.codeCheck1, values.codeCheck2, values.codeCheck3 ] | filter:true).length ==1))
- when you have multiple conditions and only one must be met, use ||, which means ‘or’ in between the conditions:
((([ values.codeCheck1, values.codeCheck2, values.codeCheck3] | filter:true).length > 1) || ([ values.codeCheck1, values.codeCheck2, values.codeCheck3 ] | filter:true).length == 1))
You may have noticed there's additional parenthesis in the two examples above, this is to make sure that each condition is contained, and then the relationship between the multiple conditions is contained in order to make sure the “Visibility Condition” as a whole will run smoothly.
Comments
0 comments
Article is closed for comments.