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
916e059f
Commit
916e059f
authored
Jun 14, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added "validation events" section [skip ci]
parent
79d6616c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
input-validation.md
docs/guide/input-validation.md
+14
-0
No files found.
docs/guide/input-validation.md
View file @
916e059f
...
@@ -126,6 +126,20 @@ to describe the validation failure when the value being validated is too big and
...
@@ -126,6 +126,20 @@ to describe the validation failure when the value being validated is too big and
You may configure these error messages like configuring other properties of validators in a validation rule.
You may configure these error messages like configuring other properties of validators in a validation rule.
### Validation Events <a name="validation-events"></a>
When
[
[yii\base\Model::validate()
]
] is called, it will call two methods that you may override to customize
the validation process:
*
[
[yii\base\Model::beforeValidate()
]
]: the default implementation will trigger a
[
[yii\base\Model::EVENT_BEFORE_VALIDATE
]
]
event. You may either override this method or respond to this event to do some preprocessing work
(e.g. normalizing data inputs) before the validation occurs. The method should return a boolean value indicating
whether the validation should proceed or not.
*
[
[yii\base\Model::afterValidate()
]
]: the default implementation will trigger a
[
[yii\base\Model::EVENT_AFTER_VALIDATE
]
]
event. You may either override this method or respond to this event to do some postprocessing work after
the validation is completed.
### Conditional Validation <a name="conditional-validation"></a>
### Conditional Validation <a name="conditional-validation"></a>
To validate attributes only when certain conditions apply, e.g. the validation of one attribute depends
To validate attributes only when certain conditions apply, e.g. the validation of one attribute depends
...
...
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