PDA

View Full Version : Textfield, markInvalid issue



mschwartz
5 Jun 2009, 5:30 AM
See the code below. It's marking the field invalid on keydown, but it's removing the invalid indicator on key up.




{
xtype: 'textfield',
id: 'tf',
fieldLabel: 'label',
anchor: '-41',
msgTarget: 'side',
enableKeyEvents: true,
listeners: {
keydown: function() {
Ext.getCmp('tf').markInvalid('invalid!');
}
}
}

5 Jun 2009, 5:46 AM
confirmed.

A quick copy and paste test case:


new Ext.Window({
width : 300,
height : 100,
items : {
xtype: 'textfield',
id: 'tf',
fieldLabel: 'label',
anchor: '-41',
msgTarget: 'side',
enableKeyEvents: true,
listeners: {
keydown: function() {
Ext.getCmp('tf').markInvalid('invalid!');
}
}
}



}).show();

mschwartz
5 Jun 2009, 5:49 AM
This could be marked as a bug, or it could be the expected behaviour. It seems to me the behaviour isn't right tho...

5 Jun 2009, 5:56 AM
Good question. It seems to be an issue with the validation calling clearInvalid

mschwartz
5 Jun 2009, 6:03 AM
Good question. It seems to be an issue with the validation calling clearInvalid

Right, but the defaults seem to imply no validation will occur - clearInvalid() and markInvalid() should not be touched by the library, IMO, unless you set allowBlank: false, validator, vtype, and/or any other things that imply validation.