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

Revision #12 has been created by samdark on Mar 13, 2011, 2:38:07 PM with the memo:

Added info about date validator
« previous (#11) next (#13) »

Changes

Title unchanged

Reference: Model rules validation

Category unchanged

Tutorials

Yii version unchanged

Tags changed

Form validation, model, validation, reference

Content changed

[...]
3. `checkMX`, whether to check the MX record for the email address.
4. `checkPort`, whether to check port 25 for the email address.
5. `fullPattern`, the regular expression used to validate email addresses with the name part.
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.
[...]
+ `safe` : [CSafeValidator], marks the associated attributes to be safe for massive assignments.

+ `type` : [CTypeValidator], verifies if the attribute is of the type specified by type. (integer, float, string, date, time, datetime)
.
 
Since 1.1.7 you should use [CDateValidator] to validate dates.

1. `allowEmpty`, whether the attribute value can be null or empty.
2. `dateFormat`, the format pattern that the date value should follow.
3. `datetimeFormat`, the format pattern that the datetime value should follow.
4. `timeFormat`, the format pattern that the time value should follow.
5. `type`, the data type that the attribute should be.
[...]
99 0
114 followers
Viewed: 891 744 times
Version: 1.1
Category: How-tos
Written by: krillzip
Last updated by: Rodrigo
Created on: Nov 29, 2009
Last updated: 11 years ago
Update Article

Revisions

View all history