Catalog Client Script - Filter Select Box

stevejarman
Giga Guru

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?

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

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


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?


That's right, I don't think you can use g_filter on a select box.