PDA

View Full Version : Ext.form.Radio check event only fires once



Mads281
23 Feb 2011, 2:14 AM
I've been experiencing a problem with 3.3.1 described in more detail in the closed post below whereby the check event only fires when a Radio field is answered for the first time. This is not good when you are relying on the radio to show / hide sections of a form.

http://www.sencha.com/forum/showthread.php?13247-1.1.1-2.0-Closed-Ext.form.Radio-check-event-only-fires-once (http://www.sencha.com/forum/showthread.php?13247-1.1.1-2.0-Closed-Ext.form.Radio-check-event-only-fires-once)

I've resolved by applying an override suggested by brian.moeskau to onClick in Checkbox (Radio extends from this)


/**
* needed to ensure that oncheck event fires more than once
*/
Ext.override(Ext.form.Checkbox, {
onClick : function(){
if(this.el.dom.checked != this.checked){
var p = this.el.up('form') || Ext.getBody();
var els = p.select('input[name='+this.el.dom.name+']');
els.each(function(el){
if(el.dom.id == this.id){
this.setValue(true);
}else{
Ext.getCmp(el.dom.id).setValue(false);
}
}, this);
}
}
});