Backbone.js validation broken (0.9.9 vs. 0.9.10) -


backbone changed few things validation between these versions, first off, have explicitly pass {validation: true} set call validation trigger. there must have been change too, because doesn't work no longer.

model.set(obj, {     error : function(model, error){         //do stuff error     } }) 

i found ticket on backbone's github, answers issue if using save, not set.

https://github.com/jashkenas/backbone/issues/2153

here's solution i've discovered.

1) assign set variable called success (or whatever like)

var success = model.set(obj, {validate : true}); 

2) check status of success, , use model.validationerror

if(!success){     var error = model.validationerror;     // stuff error } 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -