Set Value to Lookup Select Box Field From Client Script

Snow Tomcal
Tera Expert

Hi All,

I have a lookup select box field that I want to populate from a client script (onChange).

I tried using g_form.setValue() but it did not worked.

Does anyone knows why or a different way to do that?

 

Thanks :))

2 REPLIES 2

Shekhar Navhak1
Kilo Sage
Kilo Sage

Hi @Snow Tomcal,

 

It should work while writing the script consider below scenarios:

 

You will have to set it with the value of your select box. If the value is numeric, then 

g_form.setValue('windows_hardware_options', 1);

 

If the value is text, then

g_form.setValue('windows_hardware_options', 'standard_laptop');

 

 

Please mark the answer correct/helpful based on Impact.
Regards, Shekhar

Gustavo Olivei1
Tera Contributor

Hi @Snow Tomcal 

If you will set the value based on a script, why do you need a lookup field? You can use a different field type and then use setvalue that you need.

Also if you to help you to see what is missing, add a code line like: alert (g_form.getValue(variablename));

 

If you can share the full code will be nice to help you.