Results 1 to 2 of 2

Thread: 1.1.0: Bug with "return false" from Ext.form.ToggleField#beforechange listener

    You found a bug! We've classified it as a bug in our system. We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext JS Premium Member
    Join Date
    Feb 2009
    Posts
    16
    Vote Rating
    0
      0  

    Default 1.1.0: Bug with "return false" from Ext.form.ToggleField#beforechange listener

    Sencha Touch version tested:
    • 1.1.0
    • only default ext-all.css




    Platform tested against:
    • Latest desktop Chrome (should be platform-independent)


    Description:
    • Returning


    Test Case:

    See this URL : http://jsfiddle.net/WJ5pp/
    There's a JS error that happens on page render, but this doesn't appear to have anything to do with the bug at hand (and this page gives similar results to my app, which does not have any JS errors).


    Steps to reproduce the problem:
    • Run the above fiddle.
    • Try to check the field.


    The result that was expected:
    • The toggle field doesn't change at all.


    The result that occurs instead:
    • The class for the toggle field changes (although the value doesn't), making the toggle turn green when it shouldn't.


    Possible fix (change in bold):
    Code:
    Ext.override(Ext.form.Toggle, {
       setValue: function(value) {
            Ext.form.Toggle.superclass.setValue.call(this, value, this.animationDuration);
    
            // Because value might change in the parent's setValue(), refresh it
            value = this.getValue();
    
            var fieldEl = this.fieldEl;
            
            if (this.constrain(value) === this.minValue) {
                fieldEl.addCls(this.minValueCls);
                fieldEl.removeCls(this.maxValueCls);
            }
            else {
                fieldEl.addCls(this.maxValueCls);
                fieldEl.removeCls(this.minValueCls);
            }
        }
    });
    Last edited by AlexKorn; 25 May 2011 at 9:27 AM. Reason: Added some more info

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    1
    Vote Rating
    0
      0  

    Default

    Thanks for this fix. I noticed this yesterday after returning "false" from a validation on beforechange. Was getting frustrated.

Similar Threads

  1. Replies: 3
    Last Post: 14 Dec 2010, 10:22 PM
  2. Help, I need to "reset"/ "clear" BeanModel bound to form
    By chalu in forum Ext GWT: Discussion
    Replies: 2
    Last Post: 28 Jul 2010, 10:56 AM
  3. Replies: 3
    Last Post: 28 Oct 2009, 6:38 AM
  4. Replies: 3
    Last Post: 19 Aug 2009, 3:41 AM
  5. "datafield" and " radio" with load data in a Form
    By launort in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 10 Aug 2009, 7:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •