Checkboxes Mandatory in Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 09:46 PM
Hi All,
we have four checkboxes on a catalog form checkbox1, checkbox2, checkbox3, checkbox4 . out of checkbox1 and checkbox2 only one of them is mandatory for submission and from checkbox3 and checkbox4 only one of them is mandatory for submission. How can achieve this?
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 09:59 PM - edited 03-26-2024 10:00 PM
Hi @pramodkumar
try this below code
you will have to use onSubmit catalog client script and verify that
function onSubmit() {
var value1 = g_form.getValue('variable_1');
var value2 = g_form.getValue('variable_2');
var value3 = g_form.getValue('variable_3');
var value4 = g_form.getValue('variable_4');
var value5 = g_form.getValue('variable_5');
var value6 = g_form.getValue('variable_6');
var value7 = g_form.getValue('variable_7');
if(!value1 && !value2 && !value3 && !value3 && !value4 && !value5 && !value6 && !value7) {
g_form.addErrorMessage("Please select at least 1 variabel");
return false;
}
return true;
}
Please mark reply as Helpful/Correct, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 10:02 PM
Hi @pramodkumar by default, the checkbox variable will hold false value, so you can write a onsubmit client script to check atleast 1 check box is selected on the combination
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 10:03 PM
Hi @pramodkumar,
You can achieve using On submit Catalog client scripts. Here is sample scripts -
if (g_form.getValue('check_box_1') == false || g_form.getValue('check_box_2') == false) {
alert("Select check box 1 or check box 2");
return false;
}
if (g_form.getValue('check_box_3') == false || g_form.getValue('check_box_4') == false) {
alert("Select check box 3 or check box 4");
return false;
}
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 10:12 PM
Hi Sagar,
out of 1 and 2 checkbox only one is required. Users should only select one checkbox and they should not select both. Same with 3 and 4.