Body
When you have multiple controls but you need to have at least one be 'selected'. Ideally you would use a checkbox for this situation, but when you have to use multiple individual checkbox controls you need to create a rule to make at least one required.
You will need to create a logic control in the form and set it as invisible and required. You can set the control as required in the properties window or with a trigger question.
In this example we are using a number control named Logic_Rule and 2 separate checkbox controls named Option_1 and Option_2 (see image).
**This concept can also be applied for other controls (textbox, textareas, uploads etc.)
|
//Main Rule for "at least one" requirement
// if A or B is selected then 1 will be entered in the Logic Rule field.
if (Option_1[0].value == 'A' || Option_2[0].value == 'B' {
Logic_Rule.value = 1;
// if none is selected then nothing will be entered in the Logic Rule field and the form will
error because the field is required.
} else {
Logic_Rule.value = null;
}
___________________________________________________________________
//Trigger Scenario:
if (Trigger_Name.value == 'Yes'){
Logic_Rule.required = true;
}else {
Logic_Rule.required = false;
Logic_Rule.required = null;
}
|