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
02cc3901
Commit
02cc3901
authored
Oct 30, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc fix [skip ci]
parent
b752d6ea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
input-validation.md
docs/guide/input-validation.md
+13
-11
No files found.
docs/guide/input-validation.md
View file @
02cc3901
...
...
@@ -83,7 +83,7 @@ You can specify the rule type in one of the following forms:
the
[
Core Validators
](
tutorial-core-validators.md
)
for the complete list of core validators.
*
the name of a validation method in the model class, or an anonymous function. Please refer to the
[
Inline Validators
](
#inline-validators
)
subsection for more details.
*
the name of a validator class
. Please refer to the
[
Standalone Validators
](
#standalone-validators
)
*
a fully qualified validator class name
. Please refer to the
[
Standalone Validators
](
#standalone-validators
)
subsection for more details.
A rule can be used to validate one or multiple attributes, and an attribute may be validated by one or multiple rules.
...
...
@@ -367,11 +367,12 @@ class MyForm extends Model
or if they have already failed some validation rules. If you want to make sure a rule is always applied,
you may configure the
[
[yii\validators\Validator::skipOnEmpty|skipOnEmpty
]
] and/or
[
[yii\validators\Validator::skipOnError|skipOnError
]
]
properties to be false in the rule declarations. For example:
>
> ```php
[
[
'country', 'validateCountry', 'skipOnEmpty' => false, 'skipOnError' => false
]
,
]
```
>
[
>
['country', 'validateCountry', 'skipOnEmpty' => false, 'skipOnError' => false],
>
]
>
```
### Standalone Validators <a name="standalone-validators"></a>
...
...
@@ -529,13 +530,14 @@ JS;
```
> Tip: The above code is given mainly to demonstrate how to support client-side validation. In practice,
you may use the [in](tutorial-core-validators.md#in) core validator to achieve the same goal. You may
write the validation rule like the following:
> you may use the [in](tutorial-core-validators.md#in) core validator to achieve the same goal. You may
> write the validation rule like the following:
>
> ```php
[
['status', 'in', 'range' => Status::find()->select('id')->asArray()->column()],
]
```
>
[
>
['status', 'in', 'range' => Status::find()->select('id')->asArray()->column()],
>
]
>
```
### Deferred Validation <a name="deferred-validation"></a>
...
...
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