Results 1 to 4 of 4

Thread: IE specific - emptyText with allowBlank:false on TextField not working [5.1.0.107]

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-15664 in 5.1.1.451.
  1. #1
    Sencha User
    Join Date
    Nov 2014
    Posts
    14

    Default IE specific - emptyText with allowBlank:false on TextField not working [5.1.0.107]

    Issue specific to Internet Explorer: When focusing in and out of the text field by pressing tab twice, the value for the textfield is set to emptyText and hence allowBlank validation fails.

    Scenario:
    1) A Form has three fields
    2) All three fields has allowBlank set to false
    3) Now start tabbing through these fields. Here you will notice that the first text field works as expected but the rest of the fields are not working correctly i.e the rest of the fields have set the value of the text field to empty text and hence allowBlank doesn't work.


    Sencha Fiddle:
    https://fiddle.sencha.com/#fiddle/f7l

    Browser: tested in IE 8, 9 and chrome. It is only reproducible using IE browsers

    Note: Until this issue is fixed please provide a workaround

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report. Looks like we're tracking this issue as EXTJS-15664, which I've now linked to this ticket. Still unresolved at this time.

  3. #3
    Sencha User
    Join Date
    Sep 2014
    Posts
    7

    Default

    It seems the problem is in the beforeFocus function of 'Ext.form.field.Text' component. When it performs me.setRawValue('') it has no effect until you unfocus and focus the textfield again.
    Code:
    beforeFocus: function() {
        var me = this,
            inputEl = me.inputEl,
            emptyText = me.emptyText,
            isEmpty;
        me.callParent(arguments);
        if ((emptyText && !Ext.supports.Placeholder) && (inputEl.dom.value === me.emptyText && me.valueContainsPlaceholder)) {
            me.setRawValue('');
            isEmpty = true;
            inputEl.removeCls(me.emptyUICls);
            me.valueContainsPlaceholder = false;
        } else if (Ext.supports.Placeholder) {
            inputEl.removeCls(me.emptyUICls);
        }
        if (me.selectOnFocus || isEmpty) {
    
            if (Ext.isWebKit) {
                if (!me.inputFocusTask) {
                    me.inputFocusTask = new Ext.util.DelayedTask(me.focusInput, me);
                }
                me.inputFocusTask.delay(1);
            } else {
                me.focusInput();
            }
        }
    },

    As a workaroud, I made it work overriding the method adding these two lines:
    Code:
    beforeFocus: function() {
        var me = this,
            inputEl = me.inputEl,
            emptyText = me.emptyText,
            isEmpty;
        me.callParent(arguments);
        if ((emptyText && !Ext.supports.Placeholder) && (inputEl.dom.value === me.emptyText && me.valueContainsPlaceholder)) {
            me.setRawValue('');
            me.getValue();
            me.setRawValue();
            isEmpty = true;
            inputEl.removeCls(me.emptyUICls);
            me.valueContainsPlaceholder = false;
        } else if (Ext.supports.Placeholder) {
            inputEl.removeCls(me.emptyUICls);
        }
        if (me.selectOnFocus || isEmpty) {
    
            if (Ext.isWebKit) {
                if (!me.inputFocusTask) {
                    me.inputFocusTask = new Ext.util.DelayedTask(me.focusInput, me);
                }
                me.inputFocusTask.delay(1);
            } else {
                me.focusInput();
            }
        }
    },

  4. #4
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for posting your workaround. For some reason it wasn't previously reflected in the message above, but this issue has been fixed in 5.1.1.

Tags for this Thread

Posting Permissions

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