- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2024 08:17 PM
i'm currently developing on washington version, and notice that if you add a few checkbox, these variables are bundled together. now, i want to make these checkboxes mandatory, or else the request cannot be submitted. how can i achieve that?
i have set all checkboxes to "Selection Required" but i can still submit request even if i dont select one of them
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2024 09:18 PM
Hi @Hafila Hatta ,
you can write an onSubmit client script as below :
function onSubmit() {
if ((g_form.getValue('checkbox_variable1') == 'false') && (g_form.getValue('checkbox_variable2') == 'false') && (g_form.getValue('checkbox_variable3') == 'false')) {
alert('Please Select at least one checkbox');
return false;
}
}
Best Regards,
Pravindra Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2024 11:59 PM
Based on what you described, all checkboxes should be true? Now you are checking if all are false, so if only one is true... it won't work. So instead check if one if false. for example:
g_form.getValue('checkbox_variable1') == false || g_form.getValue('checkbox_variable2') == false || g_form.getValue('checkbox_variable3') == false
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 02:21 AM
thanks for the help, its working now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2024 09:45 PM
Hi @Hafila Hatta ,
Even if you have set all the checkbox to 'selection required' true, it will not make each Checkbox as mandatory, it will bundle all the checkbox together and even if any one is selected, mandatory will be greyed out ,
So use a on submit client script to check if all the check boxes which you want to be mandatory are returning value as "true" .If yes allow the requestor to submit the catalog item .If not stop the submission.
if(g_form.getValue('checkbox_1')==true && g_form.getValue('checkbox_2')==true)
return true;
else
return false;
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 06:13 AM
Thanks for marking my answer as helpful. If it helped you in any way please accept the solution so that it will be beneficial to the future readers with the same query.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2024 09:55 PM
please share your screenshot
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader