O'Reilly logo

Seven Web Frameworks in Seven Weeks by Frederic Daoud, Jack Moffitt

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

Day 3: Working with Models

In our third and final day of learning CanJS, we’ll discover more ways of working with observes and models. Remember that they are two of the focal points of a CanJS application. Drive the model and let views update themselves. Trigger events on observes and handle them in controls.

Let’s unravel how we can mold models to different requirements by creating filtered lists and by adding helper functions. We’ll start with some validation on the bookmark model.

Adding Validation

In our Sinatra web application, each bookmark must have a title and a URL. We also check the URL’s format. Server-side validation is nice—and essential—but client-side validation gives the user more immediate feedback and saves unnecessary client-server ...

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