UI Script to require at least one in a list of checkboxes be checked for form to be submitted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2018 02:07 PM
I am working on a donations form and I have a list of check boxes, at least one needs to be checked for the form to be submitted. I'd like a notice to popup on submit if the user did not select at least one checkbox.
I'm thinking a UI script on submit would do the trick but I fall short on how to write the section to check if at least one of the boxes is checked.
I found this in the question: onSubmit client script to prevent form submission
function onSubmit() {
if(g_form.getValue('ad_domain') == 'YES' || g_form.getValue('ad_domain') == 'YESb' && g_form.getValue('question_choice') == 'incorrect_info'){}
if(g_form.getValue(user_confirm') == 'false' ){ //this is the checkbox
alert('Please be sure to check the box before submitting a ticket.');
return false;
}
}
Kinda does the trick but it is looking at specific check boxes to be checked.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2018 02:14 PM
Hi,
If at least one checkbox needs to be checked before submit, it means it should be Mandatory. Follow these steps:
1. Right-Click in your first checkbox
2. Click on "Configure Variable"
3. Once you are inside of your variable, select "Selection Required"
4. CheckBoxes are Mandatory
Hope this helps,
Pedro Lopez

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2018 05:28 PM
Hi Pedro,
Sorry if I wasn't clear. The requester needs to select at least one of the check boxes but not all check boxes. I don't want to make them all mandatory. The concern is the requester will complete the request without specifying at least one of the check boxes.
LLBCDL

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2018 05:34 PM
I didn't realize check boxes worked that way. That was easy.
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2018 05:50 PM
Actually that makes them all mandatory. I want the requester to select at least one but not all. My concern is that the requester will not select any.