View Full Version : Getting a radiogroup value.

11 Aug 2009, 9:54 AM
Ive got the following radiogroup in my code:

xtype: "radiogroup",
columns: 2,
fieldLabel: "Informar layout dos Campos?",
horizontal: true,
items: [
boxLabel: "Sim",
name: "agn_layout",
id: "agn_layout_1",
inputValue: 1,
listeners: {
"check": function (t, c) {
var columnModel = grid.campos.getColumnModel();
columnModel.setHidden(columnModel.findColumnIndex("cag_posicao"), c);
columnModel.setHidden(columnModel.findColumnIndex("cag_inicio"), (!c));
boxLabel: "No",
checked: true,
id: "agn_layout_0",
name: "agn_layout",
inputValue: 0,

Whe I use form.getValues() if gets all the fields values but the radiogroup value.

Anybody knows how to get its value?

Thanks in advance.

11 Aug 2009, 10:01 AM
You posted to the Ext 3.0 forum. In Ext 3.0 a RadioGroup has a working getValue method.

However, if you posted in this forum by accident and are actually using Ext 2.x you can use the getGroupValue method of the first radio, e.g.

var value = radioGroup.items.first().getGroupValue();

11 Aug 2009, 10:18 AM
Actualy Im using Ext 3.0. I just wanna know why the form getValues method does not get the radiogroup value.

11 Aug 2009, 10:23 AM
BasicForm.getValues selects all <input> and <select> elements inside the <form> and extracts their current value. It should return the values of all rendered fields inside the form, so:
1. Is the radiogroup rendered?
2. Is the radiogroup inside the FormPanel?

11 Aug 2009, 10:33 AM
My answer is "yes" for both questions. hehehe

11 Aug 2009, 9:53 PM
That only leaves:
- Are the radios disabled?

If not, then I don't understand why formPanel.getForm().getValues() wouldn't return the radiogroup value.

30 Apr 2010, 12:28 AM
For Extjs 3.2, i use the following :