Closed pkhodaveissi closed 11 years ago
As mentioned in the validate section passing {validate: true}
into the options
for set
will do the trick - validate
is only defaulted on save
.
isn't the default for the validate(attr, option) is that the option is "validate: true" ?
No, it's only defaulted to true on save
- otherwise you need to say this.set(attrs, {validate: true})
That was changed as of 0.9.10: http://backbonejs.org/#changelog
thanks for the fast response
backbone validate does not stop set from setting the attribute, what should I do to make it do so? isValid shows the correct result( which is false)...
var Person = Backbone.Model.extend({ defaults: { name: 'John Doe', age: 30, occupation: 'worker' },
});