How to get value of choice list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2012 03:22 PM
Hi @ all,
i need a client script (onchange) to manipulate a textfield ('name'). To read the value of a textfield ('city') is no problem, but how can i do this with my choice list? I need the actual selected value (or label) of the choice list.
Thank you for your help!
---------
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
//Type appropriate comment here, and begin script below
var city;
var type;
city = g_form.getValue('city');
type = g_form.getValue('type'));
g_form.setValue('name', type + ' ' + city);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2012 04:16 AM
try this one:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
var mycity = g_form.getValue('city');
var typeValue = g_form.getValue('category');
var typeLabel = g_form.getOption('type', typeValue).label;
g_form.setValue('name', typeLabel + ' ' + mycity);
}
you should catch the value of the field and then find the label corresponding to that value.