Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
4e7421d6
Commit
4e7421d6
authored
Dec 12, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #6505
parent
481e4803
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
13 deletions
+4
-13
input-validation.md
docs/guide/input-validation.md
+4
-13
No files found.
docs/guide/input-validation.md
View file @
4e7421d6
...
...
@@ -22,15 +22,6 @@ if ($model->validate()) {
}
```
Behind the scenes, the
`validate()`
method does the following steps to perform validation:
1.
Determine which attributes should be validated by getting the attribute list from
[
[yii\base\Model::scenarios()
]
]
using the current
[
[yii\base\Model::scenario|scenario
]
]. These attributes are called
*active attributes*
.
2.
Determine which validation rules should be used by getting the rule list from
[
[yii\base\Model::rules()
]
]
using the current
[
[yii\base\Model::scenario|scenario
]
]. These rules are called
*active rules*
.
3.
Use each active rule to validate each active attribute associated with that rule. If the rule fails,
keep an error message for the attribute in the model.
## Declaring Rules <a name="declaring-rules"></a>
...
...
@@ -92,10 +83,10 @@ If you do not specify an `on` option, it means the rule will be applied to all s
When the
`validate()`
method is called, it does the following steps to perform validation:
1.
Determine which attributes should be validated by
checking the current
[
[yii\base\Model::scenario|scenario
]
]
against the scenarios declared in
[
[yii\base\Model::scenarios()
]
]. These attributes are the active attributes
.
2.
Determine which
rules should be applied by checking the current
[
[yii\base\Model::scenario|scenario
]
]
against the rules declared in
[
[yii\base\Model::rules()
]
]. These rules are the active rules
.
1.
Determine which attributes should be validated by
getting the attribute list from
[
[yii\base\Model::scenarios()
]
]
using the current
[
[yii\base\Model::scenario|scenario
]
]. These attributes are called
*active attributes*
.
2.
Determine which
validation rules should be used by getting the rule list from
[
[yii\base\Model::rules()
]
]
using the current
[
[yii\base\Model::scenario|scenario
]
]. These rules are called
*active rules*
.
3.
Use each active rule to validate each active attribute which is associated with the rule.
The validation rules are evaluated in the order they are listed.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment