I use the form yii2 to get data from the user!
It is necessary for each input field of the form, to make its own conclusion about the incorrectly entered data.
The model class looks like this:
<?php namespace app\models; use yii\base\Model; class MyForms extends Model{ public $name; public $email ; public function rules() { return [ [['name' , 'email'], 'required', 'message' => 'имя не введено'], [['name' , 'email'], 'trim'], ['email', 'email', 'message'=> 'введите адрес'] ]; } public function attributeLabels(){ return [ 'name' => 'Ваше ім'я', 'email' => 'Електронна пошта', ]; } public function getErrors($attribute = null) { return [ 'name' => ['не введенное имя'], 'email' => ['не правильный адрес'], ]; } } But for some reason, the message sent for the name is displayed! And getErrors I understand it, is also not responsible!
I ask for help to a newbie in yii))
How to implement it correctly?