getOption always return null

bourhoud
Kilo Expert

Hi all,

I have a problem for getting value of a choice list, in a client script.

In a form, I have a field, type choice, with any specified choices. Its name is u_quotation_type.

In a client script, I try to get dynamically the display value of an option.

For this, I'm trying to use g_form.getOption, and then get its innerText property.

And there, is the problem : my getOption always return null..

Below my (simple) code :

alert( g_form.getValue('u_quotation_type'));     // Displays "option"

alert(g_form.getOption("u_quotation_type", 'option')); // Displays null

alert(g_form.getOption("u_quotation_type", 'Option')); // Displays null

alert(g_form.getOption("u_quotation_type", g_form.getValue('u_quotation_type'))); // Displays null

I'm working on a Helsinki instance.

Can anyone give me help, please ?

18 REPLIES 18

Yes you could also use it in Onload client script, no problem in it. I will check   in my dev instance and I will let you know the right code.



Thanks


Thanks Harish !



Could you test it on a Helsinki instance ? Maybe it was working in previous versions of SNOW..


You can use it on client script



var quotationValue = g_form.getValue(u_quotation_type);


var displayValue= g_form.getOption(u_quotation_type, quotationValue).text;





bourhoud
Kilo Expert

Hi all,



So, I've resolved my issue : the field was ReadOnly (ACL and dictionnary).


If ReadOnly, the getOption method doesn't work (this is not really nice, but that's it ^^)



Thanks to all for your help.