Changes
Title
unchanged
Reference: Model rules validation
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
Form validation, model, validation, reference, validation rules, validator
Content
changed
[...]
If this option is not set, the rule will be applied in any scenario.
See the section [Scenarios][#Scenarios] for details.
+ *message*: replaces the default error message if validation fails.
+ *...validation parameters...*: any number of extra parameters to be used by the specified validator.
**Note**: You may get into trouble when using model's attributes as additional parameters for validators. Take a look at: [https://github.com/yiisoft/yii/issues/3001](https://github.com/yiisoft/yii/issues/3001 "https://github.com/yiisoft/yii/issues/3001")
### Choice of validators[...]
through the `"on" => "scenario"` parameter.
## Validation rules reference
For each rule, the list of its specific arguments is given with the eventual default value *(in italics)*.[...]
7. **tooSmall**, the error message used when the uploaded file is too small.
8. **types**, a list of file name extensions that are allowed to be uploaded. *(null, meaning all extensions)*
9. **wrongType**, the error message used when the uploaded file has an extension name that is not listed among extensions.
10. **mimeTypes**, a list of MIME-types of the file that are allowed to be uploaded. *(requires fileinfo PHP extension)*
11. **wrongMimeType**, the error message used when the uploaded file has a MIME-type that is not listed among mimeTypes.
### `filter` : [CFilterValidator][...]
* [CUniqueValidator]
* [CUnsafeValidator]
* [CUrlValidator]