Clear Up
SharpKit Reference

Errors Class

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 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
isValid() Returns true if there are no errors in the collection
© Copyright 2005-2011 SharpKit. All rights reserved.