Difference between #13 and #14 of
Reference: Model rules validation

Revision #14 has been created by huanito on May 4, 2011, 6:26:43 PM with the memo:

added date example for 1.1.7
« previous (#13) next (#15) »


Title unchanged

Reference: Model rules validation

Category unchanged


Yii version unchanged

Tags unchanged

Form validation, model, validation, reference

Content changed

1. `allowEmpty`, whether the attribute value can be null or empty.
2. `format`, value format. Can be an array or a string. By default it's 'MM/dd/yyyy'. All other formats are described in [CDateTimeParser] API.
3. `timestampAttribute`, name of the attribute that will receive date parsing result. By default the value is null.
4. NOTE: The date validator was added in Yii **1.1.7** - it's not available prior to that

   Example of date rule ('allowEmpty' defaults to true);
   array('org_datetime', 'date','format'=>'yyyy-M-d H:m:s'),
+ `default` : [CDefaultValueValidator], sets the attributes with the specified value. It does not do validation. Its existence is mainly to allow specifying attribute default values in a dynamic way.
1. `setOnEmpty`, whether to set the default value only when the attribute value is null or empty string.
2. `value`, the default value to be set to the specified attributes.

+ `email` : [CEmailValidator], validates that the attribute value is a valid email address.
1. `allowEmpty`, whether the attribute value can be null or empty.
97 0
Viewed: 767 687 times
Version: 1.1
Category: How-tos
Written by: krillzip
Last updated by: Rodrigo
Created on: Nov 29, 2009
Last updated: 4 years ago
Update Article


View all history