Fetching catalog checkbox variable value in its client script

srath
Tera Guru

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?

8 REPLIES 8

Subhajit1
Giga Guru

Hi Sitarani,


Kindly try the condition:-


if(temp1 != 1)


{


alert('Please check the field checkbox_var1');


}




Thanks,


Subhajit


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.


Hi Sitarani,


Try this condition:-


if(temp1 != true)


{


alert('Please check the field checkbox_var1');


}



Thanks,


Subhajit


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee