PDA

View Full Version : How do you getText of a select form field?



profunctional
20 Jul 2010, 11:52 AM
There is a getValue, but no getText. Please advise how I could retrieve the text of the selected value. Thanks.

evant
20 Jul 2010, 5:42 PM
It's just a normal old select box:



var el = Ext.getCmp('select').fieldEl,
val;
el.select('option').each(function(opt){
opt = opt.dom;
if(opt.selected){
val = opt.text;
return false;
}
});

profunctional
20 Jul 2010, 6:08 PM
Thanks Evan, That worked perfectly.