backbone.validation
backbone.validation copied to clipboard
Allow pre-validating against itself or another set of attributes
trafficstars
This PR is a solution to https://github.com/thedersen/backbone.validation/issues/211. It allows pre-validating a set of attributes against itself or another set of attributes.
// Validate a hash of attributes against itself
// Pass in either `true` or an attribute hash as the 2nd parameter.
// Neither of the examples below will result in any errors.
var errors = model.preValidate({ password: 'value', passwordConfirmation: 'value' }, true);
var errors = model.preValidate({ password: 'value' }, { passwordConfirmation: 'value' });
Note: I did write the tests, but since npm install buster failed, I couldn't actually run them.
+1! @thedersen
Any update on this?