Answer the question
In order to leave comments, you need to log in
Yii2: Unique validator returns an empty window. How to return an error?
The user model has a rule (rule)
When filling in an address that is already in the database, the input is highlighted in green (instead of red), and when submitting the form, we get an empty window and nothing is saved. How to give an error to the user?
Found something like this on google['email', 'unique']
['email', 'unique', 'targetClass' => '\app\models\User',
'message' => 'This email address has already been taken.'],
Answer the question
In order to leave comments, you need to log in
Show how to display the form, it should be something like this
$form = ActiveForm::begin();
$form->field($model, 'email');
ActiveForm::end();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question