thedersen / backbone.validation

A validation plugin for Backbone.js that validates both your model as well as form input
thedersen.com/projects/backbone-validation
MIT License
1.32k stars 300 forks source link

Don't validate during model.clear({ silent: true }) #107

Closed jabbett closed 11 years ago

jabbett commented 11 years ago

I need to clear() a model to reset a form. Unless I use forceUpdate, the clear() doesn't work, but when I do, it causes my entire form to go red, since the 'required' validations fail.

I figured I'd use silent so that the model wouldn't validate again:

this.model.clear({
  silent: true,
  forceUpdate: true
});

But backbone.validation doesn't seem to respect the silent option.

Happy to do this another way if that's preferable.

thedersen commented 11 years ago

This should be fixed in Backbone 0.9.10, where you have to opt in for validation except for save http://backbonejs.org/#Model-validate