Revision #11 has been created by samdark on Jan 18, 2011, 9:56:28 PM with the memo:
Added encoding to length
« previous (#10) next (#12) »
Changes
Title
unchanged
Reference: Model rules validation
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
Form validation
Content
changed
This is a reference to be used for Model rule validation and is compiled from the Yii documentation and code. The purpose is to have all the information gathered in one place instead of scattered. This reference is not an intro.
Applies to Yii: 1.0.10
## How validation works
The [CModel] class uses a method named [CModel::rules()] to return an array with the rules for validation.[...]
+ `length` : [CStringValidator], validates that the attribute value is of certain length.
1. `allowEmpty`, whether the attribute value can be null or empty.
2. `encoding` , string encoding.
3. `is`, exact length.
34. `max`, maximum length.
45. `min`, minimum length.
56. `tooLong`, user-defined error message used when the value is too short.
67. `tooShort`, user-defined error message used when the value is too long.
+ `numerical` : [CNumberValidator], validates that the attribute value is a number.
1. `allowEmpty`, whether the attribute value can be null or empty.
2. `integerOnly`, whether the attribute value can only be an integer.
3. `max`, upper limit of the number.[...]