Answer the question
In order to leave comments, you need to log in
What is the proper way to use yii eachvalidator?
the crux of the matter is the following I use select2 with multiple choice I get in the query the following array
should get
'thema' => [ 0 => 'детктив' 1 => 'фантасика' 2 => 'роман' ]
['thema','each','rule'=>['min'=>2,'max'=>5]]
Invalid validation rule: a rule must be an array specifying validator type.
'thema ' => [ 0 => '1' 1 => '2' 2 => '4' ]
Answer the question
In order to leave comments, you need to log in
Good afternoon.
It is unlikely that you will succeed, because the error says that "the rule must be an array that defines the type of the validator."
Example:
['thema','each','rule'=>['integer']]; // определяет, что каждое значение должно быть целым числом
['thema','each','rule'=>['match', 'pattern' => '/[a-z]/is']]; // проверяет каждое переданное значение на соответствие введённых символов
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question