Catalog Client Script - onSubmit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2017 02:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2017 02:34 AM
Hi Chauhan,
Write onsubmit catalog client script.
if(g_form.getValue('mouse') == ''&& g_form.getValue('keyboard') == ''&& g_form.getValue('headset') == ''){
alert('Please select atleast one accessory.');
return false;
}
Regards,
Sadasiva
Please mark helpful/ correct based on the impact

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2017 02:35 AM
Hello Pushpanjali,
Please use the below script
var a = g_form.getValue('mouse');
var b = g_form.getValue(keyboard');
var c = g_form.getValue('headset');
if (a==no && b==no & c==no)
{
alert('Please select at least one accessory");
return false;
}
else
{
}
ServiceNow Commnunity MVP -2018 class.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2017 02:37 AM
if 'none' is there in those options then use above script. or if the default value is 'no' then replace if(g_form.getValue('mouse') == ''&& g_form.getValue('keyboard') == ''&& g_form.getValue('headset') == '') with if(g_form.getValue('mouse') == 'no'&& g_form.getValue('keyboard') == 'no'&& g_form.getValue('headset') == 'no')
Regards,
Sadasiva
Please mark helpful/ correct based on the impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2017 02:54 AM
Hello,
I have written below script as per the suggestion.
function onSubmit() {
if(g_form.getValue('apns_mouse') == 'false' && g_form.getValue('apns_keyboard') == 'false' && g_form.getValue('apns_headset') == 'false' && g_form.getValue('docking_stations') == 'false')
return ;
{
//alert(g_form.getValue('contact_type'));
//g_form.setMandatory('assigned_to', true);
//Edited by Pushpanjali 21st July
alert("Please select atleast one accessory");
}
return false;
}
Now even after selecting one or all the accessories , the script is running and unable to Submit the requeat.