-
19 Sep 2007 7:04 AM #1
[1.1.1/2.0][Closed]Ext.form.Radio check event only fires once
[1.1.1/2.0][Closed]Ext.form.Radio check event only fires once
There is a bug in Ext.form.Radio which prevents the check event from being fired more than once.
You can see this bug displayed by the uploaded zip file. (This can drop right into the examples/form/ directory.) This affects Ext 1.1.1 and does not matter what adapter/browser you are using.
The problem is Radio was built as a subclass of Checkbox. When you turn a checkbox off to its inactive state, the old checkbox will receive a DOM event because they were clicked. This is not the case with a radio button. The previously active radio does not receive a DOM event when you toggle between another radio within the radio group even though it was just turned off.
Since the old radio never receives an event the this.checked variable which Ext maintains becomes stale at true. Therefore the next time it is clicked, both the dom and this.checked are already in agreement and no event will be fired. setValue makes sure that the dom and Ext agree on it's state. However, since we don't have an event for the old radio we need to find a way to retrieve the radio and set its checked state properly.
It's easy to retrieve a reference to the actual dom input like so in the onClick:
What is not so easy is to retrieve the actual instance of Ext.form.Radio to update this.checked to its proper state because we have no reference to the form or other radios in the same group.Code:var selector = String.format('input[name={0}]', this.el.dom.name); var els = this.el.up('form').select(selector).each(function(curRadio) { // display any stale checkboxes. if (curRadio.checked !== curRadio.dom.checked) { console.dir(curRadio); } });
Aaron
-
20 Sep 2007 12:36 AM #2
This issue is also relevant to the latest build in 2.0 SVN.
Aaron
-
4 Oct 2007 10:57 AM #3
workaround
workaround
I wanted to use radio buttons to enable and disable sections of a form based on the radio selection. I found the following workaround.:
Hope this helps someone.Code:myRadio1.on('check', function(){ //Explicitly set the checked property (workaround) myRadio1.checked=true; myRadio2.checked=false; //enable items in this section myCombo1.enable(); //disable items in the other section myCombo2.disable();}); //Do the same for myRadio2.
-
8 Oct 2007 5:16 PM #4
-
13 Nov 2007 9:20 AM #5
-
16 Nov 2007 5:54 AM #6
Extreamly bugging bug. The thing is, it's basic functionality and it doesn't work...
-
23 Nov 2007 4:02 AM #7
Same here. This bug must be fixed, since it renders radio buttons useless.
-
3 Dec 2007 7:22 PM #8
Just wondering if this has been fixed in the 2.0 release? I couldnt see it specifically mentioned in the changes.txt
-
4 Dec 2007 3:38 AM #9
The problem still exists in the 2.0 release.
I just do the test
-
6 Dec 2007 10:15 AM #10


