-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Failed validation does not trigger error callback #2153
Comments
Running code example in #2154. Sorry for duplicating, but you were only 30 minutes faster than me ;-) |
This hasn't been documented very well yet, but due to the ambiguity of a catchall model.save({bad: 'attr'}, {
success: function () {}, // all good
error: function () {} // xhr error
})
if (model.validationError) {
// validate error(s) accessible in model.validationError
} This pattern was chosen rather than a callback because |
Ok, makes sense, thanks. Please update the documentation for the 1.0 release. |
Keeping this one open until the docs get updated, just so we don't forget. |
Also, the docs haven't been updated to say that 'invalid' is the new event name instead of 'error'. |
Everything should be documented on this one now, closing. |
The documentation for Model validate (http://backbonejs.org/#Model-validate) still mentions being able to pass in an error callback on the set method. |
@caseywebdev : model.validationError you give in your example is not mentioned anywhere on the Backbone site. |
Version 0.9.10 does not trigger the error callback when validation fails on a save. This used to work until 0.9.9. The following line was removed in 0.9.10:
The comment above the method reads
An "invalid" event is triggered, but no callback is called. Furthermore, the documentation doesn't mention an "invalid" event or callback, it's still called "error" there:
The text was updated successfully, but these errors were encountered: