Is it possible to setValue of a Catalog Select Box Variable if the value is text vs integer?

tlock
Tera Guru

I'm trying to get a client script working on a Service Catalog form that will set the value of a Select Box variable. This is an onChange script based on another variable on the form.

Now I can get this to work if the value of the select box option is a number, but if the value is text, I can't get the script to work.   It's not a big deal if I have to change all my values over to numbers, but it just seems easier to have the values more readable in the script by mirroring the select box text options.

Examples:

This works to change the value of a select box variable:

g_form.setValue('server_type', 1);

Things I've tried that don't work:        

g_form.setValue('server_type', virtual);

g_form.setValue('server_type', 'virtual');

g_form.setDisplayValue('server_type', 'Virtual');

If anybody can help steer me in the right direction on this I'd really appreciate it.

1 ACCEPTED SOLUTION

tlock
Tera Guru

I'm not sure why it didn't work when I initially tested this, but this way does actually work for what I needed:



g_form.setValue('server_type', 'virtual');


View solution in original post

1 REPLY 1

tlock
Tera Guru

I'm not sure why it didn't work when I initially tested this, but this way does actually work for what I needed:



g_form.setValue('server_type', 'virtual');