O'Reilly logo

Sencha Touch Cookbook - Second Edition by Ajit Kumar

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

Validations in models

A model definition represents the structure of the data that has one or more fields. For example, a payment model containing a paymentDate field to store the date when the payment was made. Now, when we construct the models using the incoming data, there may be certain rules that we would like to apply to make sure that the model represents a valid data. For example, on a payment model, it may be required to have a paymentDate field and also it may be required that the value in this field is in the past (prior to today's date). This kind of mechanism helps us to build robust applications.

Sencha Touch provides support for this using the validations on Model. There are predefined lists of validations that we can use to set ...

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