PDA

View Full Version : Field get last validation error



demongloom
26 May 2009, 7:09 AM
Small extension for field class, which add ability to get last validation error message.
Sometimes it's required for deferred validation, when known thats field is invalid, but is not possible to know why its invalid.



/**
* Added ability to get/store last validation message
*/
Ext.override(Ext.form.Field, {

lastValidationMessage: null,

getLastValidationMessage: function() {

return this.lastValidationMessage;

}

});

Ext.form.Field.prototype.markInvalid = Ext.form.Field.prototype.markInvalid.createSequence( function(msg) {

this.lastValidationMessage = msg;

});

bmcclare
10 Jun 2009, 9:38 AM
Very much appreciated!

BIS
16 Jun 2009, 10:59 AM
good work,
had to shorten the function name though ;)