How to hide multiple choice option on the form?

Blessy2
Tera Contributor

Hi,

Requirement :  To hide multiple choice option based on other field change

I tried with onChange client script. Checked using g_form.removeoption, setDisplay, setVisible. But not able to hide the radio button.

Is there a way to hide the radio button?

Thanks in advance

 

 

8 REPLIES 8

Hi, I tried it using client script, but not working

SumanthDosapati
Mega Sage
Mega Sage

Hi,

 

 

You cannot use g_form.removeOption for a multiple choice type of variable(radio button).

You have below options :

1) Use select box(dropdown) instead of multiple choice variable

 

2) Create two different radio button variables with same name in which one has all options, and other radio button has only few options(dont include options you need to hide)

Then write an onchange client script to show the first or second variable based on selection.

 

3) You can write a global ui script and use it in client script to disable the option instead of hide.

http://www.servicenowguru.com/scripting/client-scripts-scripting/removing-disabling-choice-list-opti... has that script

 

 

Mark as correct or helpful as applies

Regards,

Sumanth

 

 

Aman Kumar S
Kilo Patron

You have to use DOM manipulation, which is never a good idea

There's a workaround that you can try

you can have more than one multi choice fields, for eg

Request Type(req_typ_1) -> 

  • New   
  • Update 
  • Delete

Request Type(req_typ_2) ->

  • New   
  • Update 

 

Use to hide/show on your condition, by this you can prevent using DOM manipulation which I think is a win - win.

Best Regards
Aman Kumar

Feel free tomark correct if it resolves your issue. Future visitors will find it helpful 🙂
Best Regards
Aman Kumar