Clear Up
SharpKit Reference

Errors Class


Base Types



Name Description


Name Description
extend @author Ed Spencer @class @extends Ext.util.MixedCollection *

Wraps a collection of validation error responses and provides convenient functions for accessing and errors for specific fields.


Usually this class does not need to be instantiated directly - instances are instead created automatically when {@link validate} on a model instance:

//validate some existing model instance - in this case it returned 2 failures messages
var errors = myModel.validate();
errors.isValid(); //false
errors.length; //2
errors.getByField('name');  // [{field: 'name',  message: 'must be present'}]
errors.getByField('title'); // [{field: 'title', message: 'is too short'}]


Name Description
getByField(JsString) Returns all of the errors for the given field @param {String} fieldName The field to get errors for @return {Object[]} All errors for the given field
isValid() Returns true if there are no errors in the collection @return {Boolean}
© Copyright 2005-2011 SharpKit. All rights reserved.