getOption always return null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2016 08:32 AM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 01:10 AM
Hi blaze,
Thanks. That's what I did, but I'm getting "null" value.
My lines of code try different cases, but still "null" as answer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 06:19 AM
hi pierre,
everything is lower case. and as i mentioned cpu can be a word or it can be a number you have to check the value of the field in the choices list. I tested it in helsinki and it works for helsinki.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 06:27 AM
Thanks for your help.
I agree with you, and that's what I did :
alert(g_form.getOption("u_quotation_type", g_form.getValue('u_quotation_type'))); // this line should work, because it uses directly the value by getValue...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 07:24 AM
Now i get what you want to do so try this
var a = g_form.getValue('subcategory');
alert(a);
this should solve your issue.
Thank you
please mark correct/helpful if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 07:38 AM
Sorry, but it seems you haven't understood :
the goal is to get a display value of an option, in a choice list.
That's why I use the getOption method, to call text property then.
My problem is that the getOption itself sends back "null", as if it doesn't find my option ...
(Sorry if I'm not understandable =/)