PDA

View Full Version : Get selected value in a radiogroup



iNes14
17 Jan 2012, 5:07 AM
Hello,

I need to get the selected value of a radiogroup.

My radiogroup :


var form =
{
xtype: 'radiogroup',
fieldLabel: 'Operator',
id:'radiogroup',
columns: 1,
items: [
{boxLabel:'<', name:'operator', inputValue:'<'},
{boxLabel:'=', name:'operator', inputValue:'='},
{boxLabel:'>', name:'operator', inputValue:'>'}
]
}


I have try this :



Ext.getCmp('radiogroup').getValue()


and



Ext.getCmp('radiogroup').getChecked()


But it returns an array : [object Object].

What's the problem?

Thank you

mitchellsimoens
17 Jan 2012, 8:59 AM
getValue and getChecked will do the same thing. It should return an object with the name of the radio and value...


{
operator : '='
}

iNes14
17 Jan 2012, 11:34 PM
Ok I have found.




var radio = Ext.getCmp('radiogroup').getValue()

radio is an object. I had to do just :



radio.operator


And I get the inputValue.

Very simple actually... :)