Catalog Item How do you grey out previous selections

Dead Blade
Kilo Guru

Hello All, I am struggling with a script to grey out all fields before the variable being selected.   The idea is that a customer is filling out a Catalog Item, as they complete a variable field the previous field is greyed out.   If a condition is met, then the form is reset.   I believe this would be a Client Script.   Do you have an idea of how to accomplish this?

I can possibly create a script with logic to include all variables in question, but that could be lengthy, I am looking for a script that I don't have to define every variable with the Catalog Item.

Let's use example:

u_1a dropdown

u_1b selection box

u_1c multiple choice

u_1d multiple line text

u_1e date

u_1f   yes/no if no, reset form

11 REPLIES 11

oharel
Kilo Sage

Hi William,



Not sure how you can achieve that without either multiple UI policies or an onChange catalog client script for each variable.


For the last one, you can use the same script, which will either grey out u_1e or reset the form, according to the selection.



harel


Hello Harei, yes I know this... I am looking for a script that I don't have to define every variable with the Catalog Item.


Hi,



As far as I'm aware, I don't think this is possible without a bunch of code in a client script. There is however an alternative that is far less painful.



Supercharging Service Catalog for Service Portal



This is a technique I developed to help us create catalog items with 500+ variables and complex formats. The hardest part of this is that you would need to get the variables in single-quote, comma delimited. This is easily done with and export to excel.



Essentially, the functions allow you to load an array of variables into a function that may perform 1,2,50 g_form functions on each one...predefined. As an example, there's a reusable function in there to hide a variable, but this one function also sets mandatory to 'false', so really it's two steps in one.



The functions in that link above may not directly address your exact scenario, but the cool part is that it's expandable so anyone can essentially create any function they wish.



If you like what you see and you want assistance, I can expand the function set so that everyone who downloads this will benefit.



Thanks.


...also




You could do a form reset with a function. Keep in mind that once you create the comma, delimited list (one time), you can simply copy and paste it over and over again...or just those variables you wanted affected by a different function.