Fetching catalog checkbox variable value in its client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2014 03:47 AM
Hi
I have 4 check box variables in my catalog.I want to make a client script so that on submit at least one variable should be checked among those 4 variables.
I am trying with an onSubmit catalog client script..to test what it returns I tried something like this for one variable:
function onSubmit()
{
var temp1= g_form.getValue('checkbox_var1');
if(!temp1) //assumed it will return true as I have not check the variable on the form
{
alert('Please check the field checkbox_var1');
return false;
}
}
But I am not getting the popup as expected.Any suggestion where am going wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2014 05:34 AM
Hi Sitarani,
Kindly try the condition:-
if(temp1 != 1)
{
alert('Please check the field checkbox_var1');
}
Thanks,
Subhajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2014 08:59 AM
Hi Subhajit
Thanks for help.
I tried as you specified and if I am not wrong then I should get popup if I wont check the check box field on the form and I am getting that.
But though I am checking the field then as well am getting the popup.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2014 10:08 AM
Hi Sitarani,
Try this condition:-
if(temp1 != true)
{
alert('Please check the field checkbox_var1');
}
Thanks,
Subhajit

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2014 11:14 AM
You may also find the below thread as helpful
http://www.servicenowguru.com/scripting/client-scripts-scripting/checkbox-variables-mandatory/
Thanks,
Pradeep Sharma