backbone model validation error
- by koko
I got a validation based on backbone fundamentals by addyosmani, but when i try it on my view i can't get the error that the model generated.TIA
model.js
validate: function(attrs) {
var errors = this.errors = {};
if (!attrs.box)
errors.box= 'box value is required';
//console.log(errors.box);
if (!_.isEmpty(errors)) return errors;
}
view.js
validate: function(model) {
console.log("error text--" + model.errors[this.input] || '');
},