O'Reilly logo

Backbone.js Cookbook by Vadim Mirgorod

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using advanced validation in a model

By default, Backbone provides a simple way for validating model attributes using the validate() method, which allows to create your own validating function, but this can take more developer's time compared to the usage of existing solutions.

Getting ready

Why don't you save time with another Backbone extension named Backbone.Validation, which provides lots of features and allows to reuse existing validators. It is available to download from the GitHub page https://github.com/thedersen/backbone.validation.

To include this extension into your project, save the backbone-validation.js file in the lib folder and include a reference to it in index.html.

Note

Including a Backbone extension into your project is described ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required