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

Error in chapter 4 - validate doesn't work #2

Open
paulyang0125 opened this issue Oct 13, 2014 · 1 comment
Open

Error in chapter 4 - validate doesn't work #2

paulyang0125 opened this issue Oct 13, 2014 · 1 comment

Comments

@paulyang0125
Copy link

there's no "false" returned or error in the console unless you put {validate: true} on set func....

like

person.set('age', -1, {validate: true});
Age must be positive
false

Grabbed from http://www.codebeerstartups.com/2012/12/4-adding-validations-in-models-in-backbone-js-learning-backbone-js/

var person = new Person;
person.get('age')// will return 23 as default value
person.set('age', -1)// will return false and value ie -1 will not be set

person.on('error', function(model,error){
console.log(error); // printing the error message on console.
});

@huwd
Copy link

huwd commented Mar 13, 2016

Yeah, just to confirm I'm still getting the same as above.

Also in the post like 9 is written if ( attributes.age < ){ instead of if ( attributes.age < 0){

Though i realise this is an old tut now, not sure if it's still maintained?

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

No branches or pull requests

2 participants