1

After applying a LoadMask, a textfield is still editable (although masked).

Screensot

Code snippet in 3.4.0:

var enterPressedCounter=0; var btn = new Ext.Button({
     text: 'Unmask it',
     handler: function(){
         if(form.mask) form.mask.hide();
     } }); 

var textField= new Ext.form.TextField({
    fieldLabel: 'Text field',
    emptyText: 'Please enter a text and press enter',
    width: 230,
    listeners: {
        specialkey: function(field, e){
            if (e.getKey() == e.ENTER) {
                enterPressedCounter++;
                if(enterPressedCounter % 2 == 1){
                    form.mask= new Ext.LoadMask(form.el,{ msg:
                        'Now continue typing...'});
                    form.mask.show();
                }else{
                    btn.handler();
                }
            }
        }
    }
});

var form = new Ext.FormPanel({        
    frame:true,
    title: 'Load mask with text',
    bodyStyle:'padding:5px 5px 0',
    width: 500,     height: 150,        
    items: textField,
    mask: null,
    buttons: [btn] 
 });

form.render(document.body);

How can I fix this without side effects?

See also:

Ricardo
  • 3,696
  • 5
  • 36
  • 50
  • 1
    And what's the question? It's a bug and it was already reported on Sencha forums. – Darek Kay Mar 12 '15 at 01:51
  • 1
    If you're setting a mask, simply also set the field to disabled. `field.disable();` – Rob Schmuecker Mar 12 '15 at 06:59
  • 1
    Does this only happen if the field has received focus, so cursor in it ready for typing, before the mask gets applied? – mindparse Mar 12 '15 at 07:36
  • @darek, I made the question more explicit. Thanks! – Ricardo Mar 12 '15 at 16:37
  • @mindparse , it doesn't depend on the previous `focus` location, as you can press `tab` on the keyboard after the mask is applied. See this [fiddle](https://fiddle.sencha.com/#fiddle/jhe) – Ricardo Mar 12 '15 at 16:44
  • @rob, the sample I provided is a simplification version of the original problem. I have a specialized (yet reusable) combobox that queries the server to filter results on a view, with custom template, behavior, etc. Disabling and enabling works for a textfield and combobox, but not for my case. I will dig deeper and post the results. Hopefully, I'll get a fix from Sencha... Thanks! – Ricardo Mar 12 '15 at 19:46

0 Answers0