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 ...
Get Sencha Touch Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.