I’ve followed the basic procedures for obtaining the selected value of my radio button form.
....
xtype: 'radiofield',
name: 'timespan',
id: 'timespan',
value: 7,
checked: true,
fieldLabel: 'Time Span',
boxLabel: '7 days'
}, {
xtype: 'radiofield',
name: 'timespan',
value: '30',
fieldLabel: '',
labelSeparator: '',
hideEmptyLabel: false,
boxLabel: '30 days'
}, {
xtype: 'radiofield',
name: 'timespan',
value: '60',
fieldLabel: '',
labelSeparator: '',
hideEmptyLabel: false,
boxLabel: '60 days'
}, {
xtype: 'radiofield',
name: 'timespan',
value: 'all',
fieldLabel: '',
labelSeparator: '',
hideEmptyLabel: false,
boxLabel: 'All' ....
I’ve used methods like:
Ext.getCmp('filter_form').getForm().getValues()['timespan']
But when I run this to the console, instead of getting the value of the selected button, I get the word on. What gives?! I’ve tried several different combos of getValues, getForm, etc, but I always end up with on or true or false. What’s going on here?
Figured it out! Turns out that my extjs sample code has an error!
I changed
valuetoinputValue. Taken from the Sencha Docs,inputValueis:Aha!! Because I hadn’t specified a “real” value, it defaulted to
on.Be careful when using the extjs examples/sample code!