Difference between #8 and #9 of
Reference: Model rules validation

Revision #9 has been created by Steve Friedl on Nov 28, 2010, 6:25:05 PM with the memo:

Cleaned up the example for CTypeValidator; gave link to example for CUniqueValidator
« previous (#8) next (#10) »

Changes

Title unchanged

Reference: Model rules validation

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Form validation

Content changed

[...]
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.


 
   Example of time rule;  
```php 
   ~~~
 
   [php]
 
   
array('org_starttime, org_finishtime', 'type', 'type'=>'time', 'timeFormat'=>'hh:mm'), ```
 
 
   ~~~

+ `unique` : [CUniqueValidator], validates that the attribute value is unique in the corresponding database table.
[...]
5. `criteria`, additional query criteria.

    By default, CUniqueValidator works with a single attribute that's presumed to be
 
    unique across the whole model table, but it can work with multi-attribute unique
 
    constraints as well. See [CUniqueValidator::c2215] for an example.
 
 
+ `unsafe` : [CUnsafeValidator], marks the associated attributes to be unsafe so that they cannot be massively assigned.

+ `url` : [CUrlValidator], validates that the attribute value is a valid http or https URL.
1. `allowEmpty`, whether the attribute value can be null or empty.
2. `pattern`, the regular expression used to validates the attribute value.
[...]
99 0
114 followers
Viewed: 891 760 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