O'Reilly logo

Sencha Touch Cookbook 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 which 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 models using the incoming data, there may be certain rules that we would like to apply to make sure that the model represents 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 by using validations on Model. There are pre-defined lists of validations, which we can use to setup the ...

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