backbone.validation icon indicating copy to clipboard operation
backbone.validation copied to clipboard

Allow pre-validating against itself or another set of attributes

Open ragulka opened this issue 11 years ago • 2 comments
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.

ragulka avatar Feb 27 '14 15:02 ragulka

+1! @thedersen

chiefGui avatar Jan 07 '15 23:01 chiefGui

Any update on this?

dottodot avatar Apr 26 '16 11:04 dottodot