Hide Options from Select Box

jessicaa_perry
Kilo Contributor

For the Create Incident form, I added Category as an option.  I was able to add this option and it inserts into the Incident table.  Success!

However, I only want a few categories available for our users to choose from in this form.  We'll call these internal vs. external categories.  How do I hide the internal categories?

After some research, I'm trying to use the onLoad function with the g_form.removeOption, but I can't seem to get it to work.  This is my first time working with client scripts.

15 REPLIES 15

The category needs to be in small case

use category and not Category

-Anurag

I've tried that before and it didn't work.  I just tried again and it still doesn't exclude Backup Tapes from the Category drop-down.  It seems like I'm missing something big picture or just really obvious.

Make sure the value of the choice is correct. You should be passing the value and not the label there.

-Anurag

Adding on Anurag's response:

g_form.removeOption('category', 'backuptapes');  //Please have choiceValue backuptapes in quotes and then try

 

removeOption(String fieldName, String choiceValue);

Name           Type       Description
fieldName     String     Name of the field.
choiceValue   String     The value stored in the database. This is not the label.

 

More details: GlideForm - Client

jessicaa_perry
Kilo Contributor

Thank you both for your feedback! It's still not working. Here's the script that I've updated:

find_real_file.png

This is the Create Incident form where I've added the Category variable.  As you can see, Backup Tapes are still there.  I have many categories I would like to hide from the user.  I open this form in a different browser and impersonated a non-itil_admin user.

find_real_file.png