How Can I Hide a Checkbox?

bahdol5098
Tera Contributor

How can I hide a checkbox field in a catalog task?

I’m currently using the code: g_form.setVisible('variable', false);

This works as expected when the variable type is "Yes/No," but it doesn’t seem to work for a checkbox field, which I prefer because it looks cleaner on the form. Any suggestions?

6 REPLIES 6

shubhamseth
Giga Sage

@bahdol5098 

 

g_form.setDisplay('your_checkbox_variable', false);

 

if above does not work then try hiding using CSS

 

g_form.getControl('your_checkbox_variable').parentElement.style.display = 'none';

 

 

Ankur Bawiskar
Tera Patron

@bahdol5098 

it should work fine with checkbox variable as well.

please share your complete script

If my response helped please mark it correct and close the thread so that it benefits future readers.

vermaamit16
Kilo Patron

Hi @bahdol5098 

 

It should work. I tried reproducing your issue and for me, it works as expected. Refer below screenshots where I am hiding a checkbox field 'AI' on a SC task using an On-Load Client Script.

 

AmitVerma_0-1741253283165.png

 

AmitVerma_1-1741253304285.png

 

AmitVerma_2-1741253323482.png

 

Could you please share your script to assist you further? Also, check if you are passing the right variable name g_form method.

 

Thanks and Regards

Amit Verma

Medi C
Giga Sage

It should work for checkbox variable type as well.