1. #1
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,399
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default [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:
    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);
        		}
        	});
    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.

    Aaron
    Attached Files
    -->

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,399
    Vote Rating
    128
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    This issue is also relevant to the latest build in 2.0 SVN.

    Aaron
    -->

  3. #3
    Ext User
    Join Date
    Oct 2007
    Posts
    1
    Vote Rating
    0
    bwilkins is on a distinguished road

      0  

    Default 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.:

    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.
    Hope this helps someone.
    -->

  4. #4
    Ext JS Premium Member cdomigan's Avatar
    Join Date
    Mar 2007
    Posts
    148
    Vote Rating
    1
    cdomigan is on a distinguished road

      0  

    Default


    I have just hit this bug too
    -->

  5. #5
    Sencha User
    Join Date
    Aug 2007
    Location
    NYC
    Posts
    85
    Vote Rating
    0
    JEBriggs is on a distinguished road

      0  

    Default


    Ditto.
    -->

  6. #6
    Ext JS Premium Member
    Join Date
    Jul 2007
    Posts
    218
    Vote Rating
    2
    ZooKeeper is on a distinguished road

      0  

    Default


    Extreamly bugging bug. The thing is, it's basic functionality and it doesn't work...
    -->

  7. #7
    Ext User
    Join Date
    Sep 2007
    Posts
    102
    Vote Rating
    0
    timo.nuros is on a distinguished road

      0  

    Default


    Same here. This bug must be fixed, since it renders radio buttons useless.
    -->

  8. #8
    Ext User
    Join Date
    Oct 2007
    Posts
    25
    Vote Rating
    0
    Neville Burnell is on a distinguished road

      0  

    Default


    Just wondering if this has been fixed in the 2.0 release? I couldnt see it specifically mentioned in the changes.txt
    -->

  9. #9
    Sencha User
    Join Date
    Mar 2007
    Location
    Bordeaux, France
    Posts
    75
    Vote Rating
    0
    Thylia is on a distinguished road

      0  

    Default


    The problem still exists in the 2.0 release.
    I just do the test
    -->

  10. #10
    Sencha User
    Join Date
    Mar 2007
    Location
    Bordeaux, France
    Posts
    75
    Vote Rating
    0
    Thylia is on a distinguished road

      0  

    Default


    bump
    -->