Threaded View

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Nov 2010
    Vote Rating
    kvr is on a distinguished road


    Question [OPEN-1387] Radiogroup reset clears all values

    Ext version tested:
    • Ext 3.2.1
    Adapter used:
    • ext
    css used:
    • only default ext-all.css
    Browser versions tested against:
    • IE8
    • IE9
    • FF3 (firebug installed)
    Operating System:
    • Linux Ubuntu 10.10 64
    • WinXP Pro
    • Resetting a radiogroup causes all radios to be disabled, rather than
      reverting back to the original value. As reset is used by form reset this
      is rather troublesome.
    Test Case:

            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title id='title'>Radiogroup reset</title>
            <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
            <script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
            <script type="text/javascript" src="../../ext-all-debug.js"></script>
            The radiogroup below has default value choice2.<br>
            When we reset the radiogroup, all fields are cleared rather than being reset to the originalValue.<br>
            This is especially troublesome as reset is used by BasicForm.reset.<br><br>
            <div id="content"></div>
            <script type="text/javascript">
                new Ext.FormPanel({
                    renderTo: 'content',
                    items: [{
                        "id":"rg", "name":"rg", "xtype":"radiogroup", "value":"Choice 2", "items":[
                            {"inputValue":"Choice 1","boxLabel":"choice1","name":"rg"},
                            {"inputValue":"Choice 2","boxLabel":"choice2","name":"rg"}
                        ]}, {
                            xtype: 'button',
                            text: 'reset',
                            handler: function () { Ext.getCmp("rg").reset() },
                            scope: this
            }); //end onReady

    Steps to reproduce the problem:

    • Create a radiogroup
    • set a default value
    • Call reset
    The result that was expected:
    • The radiogroup should select the default value on reset
    The result that occurs instead:
    • All selections are cleared making for a very sily radiogroup
    Debugging already done:
    • It seems the checkboxgroup reset function supports two methods to set the default value:
    • If orginalValue is set, use it
    • but, originalValue is never set (normally this happens in the initValue function, but checkbocgroup has overriden this function and it does not call super and does not set the originalValue.
    • when no originalValue is set, the reset function will ask the individual radiobuttons to reset themselves to their defaultvalue
    • but radiogroup/checkboxgroup set the indivial radio values after the originalValue was stored, so the radios are always empty.
    Possible fix:
    // on radiogroup.reset all checkboxes are cleared
            initValue : function(){
                            this.setValue.apply(this, this.buffered ? this.value : [this.value]);
                            delete this.buffered;
                            delete this.value;
    Last edited by kvr; 9 Nov 2010 at 4:43 AM. Reason: Hoping to get a definite fix...

Similar Threads

  1. BasicForm.reset: Resets to default values?
    By darthwes in forum Ext 3.x: Help & Discussion
    Replies: 19
    Last Post: 1 Nov 2010, 11:29 AM
  2. Replies: 2
    Last Post: 3 Oct 2008, 5:48 AM
  3. Reset button to clear form values?
    By onmission in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 17 Nov 2007, 11:34 AM

Thread Participants: 2

Tags for this Thread