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

Revision #13 has been created by Steve Friedl on Mar 30, 2011, 3:57:31 PM with the memo:

Annotated the date validator with the 1.1.7 requirement; put it in the proper alphabetical place
« previous (#12) next (#14) »

Changes

Title unchanged

Reference: Model rules validation

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Form validation, model, validation, reference

Content changed

[...]
2. `compareAttribute`, the name of the attribute to be compared with.
3. `compareValue`, the constant value to be compared with.
4. `operator`, the operator for comparison.
5. `strict`, whether the comparison is strict (both value and type must be the same.

+ `date` : [CDateValidator], validates that the attribute value is a valid date, time or datetime.
 
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
 
 
+ `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.
[...]
6. `pattern`, the regular expression used to validate the attribute value.

+ `date` : [CDateValidator], validates that the attribute value is a valid date, time or datetime.
 
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.
 
 
+ `exist` : [CExistValidator], validates that the attribute value exists in a table.
1. `allowEmpty`, whether the attribute value can be null or empty.
2. `attributeName`, the ActiveRecord class attribute name that should be used to look for the attribute value being validated.
3. `className`, the ActiveRecord class name that should be used to look for the attribute value being validated.
4. `criteria`, additional query criteria.
[...]
97 0
117 followers
Viewed: 770 969 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

Revisions

View all history