Catalog Client Script - Filter Select Box

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2016 06:35 PM
I have a catalog form with a few select box type variables on it. I need to filter the choices in those select boxes based on choices made in OTHER select boxes on the form.
e.g. if the user selects option "A" from SELECTBOX1, then only options "X" and "Z" will be available in SELECTBOX2.
I can evaluate the value in SELECTBOX1 onChange easy enough, but how do I "filter" SELECTBOX2?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2016 06:55 PM
Hi Steve,
If you've got a select box I think your only option is to the the client side g_form.removeOption() method.
GlideForm (g form) - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2016 08:05 PM
Hmmm - guessing that means if the user then changes their mind, I'd have to use addOption to put them back. i.e. no way to just "clear the filter".
So really my only option is to put all the choices in a table which I can then show with a list, that enables me to use the weird g_filter thing, right?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 06:00 AM
That's right, I don't think you can use g_filter on a select box.