PDA

View Full Version : based on combo value the radio button automatically checked



kamalakarreddy vancha
17 Sep 2013, 1:56 AM
hi...
here i have a radio button group, one combo box with three values i.e one, two, three. the default value of combo box is two.
here if select radiobutton1 the value of combo box is changed to one.
at the same time my requirement is
if i select the value from the combo like three...
the radio button 'radiobutton2' will automatically checked.
means based on combo value the radio button are automatically checked.
please help me...
here am sending my code also...

Ext.onReady(function () {
var myform = new Ext.FormPanel({
//url: 'your.php',
frame: true,
title: 'Title',
layout:'hbox',
width:500,
items: [{
xtype:'radio',
boxLabel:'yes',
margin:'0 0 0 10',
handler:function(){
Ext.getCmp('comboId').setValue('one');
}
},{
xtype:'radio',
boxLabel:'no',
margin:'0 0 0 10'
},{
fieldLabel: 'Combo',
xtype: 'combo',
value:'two',
id:'comboId',
labelAlign:'right',
store: [[1, 'One'], [2, 'Two'], [3, 'Three']]
}],
buttons: [{
text: 'Save',
handler: function () {
}
}, {
text: 'Reset',
handler: function () {
myform.getForm().reset();
}
}]
});
var win = Ext.create('Ext.window.Window', {
title: 'Compose message',
collapsible: true,
maximizable: true,
width: 800,
height: 550,
layout: 'hbox',
items: [myform],
dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
ui: 'footer',
layout: {
pack: 'center'
},
items: [{
minWidth: 80,
text: 'Send'
}, {
minWidth: 80,
text: 'Cancel'
}]
}]
});
win.show();
})



Thanks
Kamalakar Reddy

ettavolt
17 Sep 2013, 8:16 AM
Just setup event listener for change (http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.Field-event-change) event.