Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

artyomtrityak opened this issue Dec 14, 2012 · 5 comments
Labels

Comments

@artyomtrityak
Copy link

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
Copy link
Contributor

wyuenho commented Dec 14, 2012

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

@artyomtrityak
Copy link
Author

yeah i saw

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

but why?

@wyuenho
Copy link
Contributor

wyuenho commented Dec 14, 2012

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
Copy link

Related this pull #52

@jashkenas
Copy link
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants