Silent mode does not work any more for Model.set validation #1930

Closed
artyomtrityak opened this Issue Dec 14, 2012 · 5 comments

Projects

None yet

4 participants

@artyomtrityak

https://github.com/documentcloud/backbone/blob/master/backbone.js#L573

Here is no more check for silent: true.

So if i want to disable validation with model.set(data, {silent: true}); i can not do this any more

@wyuenho

I think this change is deliberate. See commit 23cc302. The change log also mentions this.

@artyomtrityak

yeah i saw

Validation now occurs even during "silent" changes. 
This change means that the isValid method has been removed.

but why?

@wyuenho

Because you shouldn't be able to force an invalid state into a model? You can still disable validation by temporarily detaching the validator now. I like the behavior in 0.9.9. It's less surprising.

@Yahasana

Related this pull #52

@jashkenas
Owner

Yep -- it's an intentional change. Having a model in an "invalid" state, but still being able to model.get() invalid data out of it doesn't make much sense ... at least with the way that Backbone validation is intended to work.

Now it should be easier to use it for ensuring that your models are never able to enter an invalid state. If you just want an arbitrary validate(data) function, use a different function.

@jashkenas jashkenas closed this Dec 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment