Answer the question
In order to leave comments, you need to log in
How to validate the language in a form field in yii2?
There is a field
<?= $form->field($model, 'name')->label('Имя')->textInput(['placeholder' => 'Ваше имя'])?>
Answer the question
In order to leave comments, you need to log in
In the rules of the form model, specify validation rules like this ( documentation ):
[
[['name'], 'required'],
[['name'], 'string', 'min' => 3, 'max' => 16],
[['name'], 'match', 'pattern' => '<regex_rule>']
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question