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

harishdasari
Tera Guru

Hi Pierre,



please right click on the 'u_quotation_type', click on configure dictionary. now here you can see list of choices which you have been given. Now it will have values for each choice. just re-write those values with numbers like 0,1,2,3.


Now write the synatx as fallows and execute.. it will work



example ::


alert(g_form.getOption("u_quotation_type", '1'));



Thanks.



Hope this is helpful


Hi Harish,



Thanks for your response. I will try it, and give result here.


Still answer "null"



Am I alone to have this problem ? Maybe it appears in Helsinki version ?


Natsufab3
Kilo Guru

Hi Pierre,


                      I think you can get an alert message for option too using getValue example try using



alert(g_form.getValue('subcategory', 'cpu'));



this will also show an alert message of the field option you want to. and here cpu is the value of the field. It can be a number or a name it depends on your field so you have to right click on the field label and go for configure dictionary and check the choice and field value of the choice you want to populate.



Thank you


please mark correct/helpful if applicable.