range validator

thedersen edited this page Dec 26, 2011 · 2 revisions
var SomeModel = Backbone.Model.extend({
  validation: {
    age: {
      range: [1, 10]
    }
  }
});
  • number lower than first value is invalid
  • number equal to first value is valid
  • number equal to last value is valid
  • number higher than last value is invalid
  • number in range is valid
  • when required is not specified undefined is invalid
  • when required is not specified null is invalid
  • when required:false null is valid
  • when required:false undefined is valid
  • when required:true undefined is invalid
  • when required:true null is invalid