- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-18-2016 08:36 AM
I have a request on a New Joiner Catalog item.
Can someone advise me how best to get a condition to do on a variable set question label and checkbox?
What we want to do is show another field if only All is selected or if more than two check boxes are selected for the location
I managed the "all" condition
All | is | True
Field | Visible
But if someone selects London and Asia for example or America and middle east. What can I use for a condition? Basically they could select any five or just one.
Appreciate the help in advance.
Many thanks
Sarah
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2016 03:08 AM
Personally I'd find this easier to script in a client script, however, its sometimes nicer in a ui policy.
If you go the UI Policy route, you'd have to add options for every combination in the condition builder which well, you said you have 5 checkboxs, and you said if more than 2 (so 3) are checked, show some field.
So it would be like a condtion for each below
123
124
125
134
135
145
234
235
245
345
however if you just did it in a client script, you could just push the values in an array if checked and check the sum of the array, the problem with this, is you'd have to have the client script on each checkbox
Something like this should work.
function onChange(control, oldValue, newValue, isLoading) {
//Set the mandatory checkbox variable names and total mandatory count here
var mandatoryVars = ['option1', 'option2', 'option3', 'option4', 'option5'];
var variableToShow = 'someothervariable';
var requiredCount = 2;
var actualCount = 0;
for (var x = 0; x < mandatoryVars.length; x++) {
if (g_form.getValue(mandatoryVars[x]) == 'true') {
actualCount++;
}
}
if (requiredCount <= actualCount) {
g_form.setDisplay(variableToShow, true);
} else {
g_form.setDisplay(variableToShow, false);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2016 03:08 AM
Personally I'd find this easier to script in a client script, however, its sometimes nicer in a ui policy.
If you go the UI Policy route, you'd have to add options for every combination in the condition builder which well, you said you have 5 checkboxs, and you said if more than 2 (so 3) are checked, show some field.
So it would be like a condtion for each below
123
124
125
134
135
145
234
235
245
345
however if you just did it in a client script, you could just push the values in an array if checked and check the sum of the array, the problem with this, is you'd have to have the client script on each checkbox
Something like this should work.
function onChange(control, oldValue, newValue, isLoading) {
//Set the mandatory checkbox variable names and total mandatory count here
var mandatoryVars = ['option1', 'option2', 'option3', 'option4', 'option5'];
var variableToShow = 'someothervariable';
var requiredCount = 2;
var actualCount = 0;
for (var x = 0; x < mandatoryVars.length; x++) {
if (g_form.getValue(mandatoryVars[x]) == 'true') {
actualCount++;
}
}
if (requiredCount <= actualCount) {
g_form.setDisplay(variableToShow, true);
} else {
g_form.setDisplay(variableToShow, false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2016 04:05 AM
Thanks so much for this Jace,
Your message was very informative, I created all five client scripts as you suggested, tested various clicks in different combinations and it worked It works brilliantly!
I think I need to learn how to code! It has to be said I have toddler legs for that at the moment. But Admin exam first.
Kind Regards
Sarah

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-20-2016 04:12 AM
Glad it helped.