- 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-23-2024 09:02 PM
Hi there,
This is expected behavior. When adding multiple checkboxes after each other, they are automatically grouped. Also read:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0720517
The article does mention a workaround involving containers. What you might also do, create an onSubmit Client Script which checks if every checkbox variable is true or not.
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-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:48 PM
hi the script doesnt work for me. anything i did wrong?

- 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