[[+content_image]]
I
I
Ilya Beloborodov2017-06-09 10:46:09
Yii
Ilya Beloborodov, 2017-06-09 10:46:09

Yii2, validation, don't use rule when using script?

To use the rule in a specific scenario, we do this:

[['phone', 'email'], 'required', 'on' => self::SCENARIO_DEFAULT],

is it possible vice versa? "Use script everywhere except the specified script"

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
M
Maxim Fedorov, 2017-06-09
@kowap

to specify a script to which the validation rule should not apply, you must specify its name in the except parameter of the rule , for example:

[['phone', 'email'], 'required', 'except' => self::SCENARIO_DEFAULT],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question