var fp = new Ext.FormPanel({
frame: true,
title:'Check/Radio Groups',
labelWidth: 110,
width: 600,
renderTo:document.body,
bodyStyle: 'padding:0 10px 0;',
defaultType: 'radio', // each item will be a radio button
items: [{
xtype: 'textfield',
name: 'txt-test2',
fieldLabel: 'Alignment Test'
},{
checked: true,
fieldLabel: 'Favorite Color',
boxLabel: 'Red',
name: 'fav-color',
inputValue: 'red'
},{
fieldLabel: '',
labelSeparator: '',
boxLabel: 'Blue',
name: 'fav-color',
inputValue: 'blue'
},{
fieldLabel: '',
labelSeparator: '',
boxLabel: 'Green',
name: 'fav-color',
inputValue: 'green'
}],
buttons: [{
text: 'Save',
handler: function(){
Ext.Msg.alert("",fp.form.findField("fav-color").getGroupValue());
}
},{
text: 'Reset',
handler: function(){
fp.getForm().reset();
}
}]
});
转自:http://tmsoft.lsxy.com/index.php?load=read&id=747