Reset the select box to none if i select a checkbox on catalog form

naresh110
Giga Contributor

Hi Everyone,

I am trying to reset the select box to none if i select a check box on the catalog form.

like if i select some option and then click the checkbox it should reset to none.

Capture.PNG

Like in above snapshot when i select checkbox the select box should remain as none.

Capture2.PNG

But my issue is that even if i select the checkbox it is showing possibility to select an other option.

when we select that box there should not be any possibility to select another option , if we select some option also it should reset to none.

Can anyone please help me out to resolve this issue.

Thank You In Advance.

6 REPLIES 6

Ashish Nahar
Kilo Guru

Use UI policy and make the field read only. Also if your field was set to mandatory then make it nonmandatory as well as you are making it read only.


Hi Ashish Nahar,



What you have suggested is almost met my requirement but still i have an issue with that.


Capture4.PNG


As shown in the above snapshot when i select some option and select the check box the select box is displaying the previous selected option but i need it to be reset to none after i select the check box.



can you please help me out.



Thank You.


You can achieve that by on change client script, if the value change in the


select box to true, it should clear out the value in the other field and


make it read only as well.



Don't do it through UI policy but do it through client script.



Check will on achieving this using g client script. Sorry I am replying


from my mobile.



On Jun 14, 2017 12:02 AM, "naresh1" <community-no-reply@servicenow.com>


Write onchnage client script on check box


Try below script



  1. function onChange(control, oldValue, newValue, isLoading, isTemplate) {  
  2. if (isLoading ) {  
  3.         return;  
  4. }  
  5.     if (newValue == true){  
  6.       g_form.setValue('selectbox variable', '--None--');  
  7.   }  
  8.  
  9. }