In the login form, I need to have the glyphicon-remove icon at the end of each validation message with the corresponding field names. Therefore, I used the code below in the Login model .
['email', 'required', 'message' => 'Email cannot be blank<span class="glyphicon glyphicon-remove"></span>'], ['password', 'required', 'message' => 'Password cannot be blank<span class="glyphicon glyphicon-remove"></span>']
Instead, above the code, is there any possible way to use something like the code below.
[['email', 'password'], 'required', 'message' => $attribute.' cannot be blank<span class="glyphicon glyphicon-remove"></span>']
The idea of ββthe code above is to get a dynamic field name for each field.
Please do the necessary. Thanks.
Update
The HTML code ( <span class="glyphicon glyphicon-remove"></span> ) that I used is correctly displayed using encode=>'false' . But I need instead of defining separately for each field, I need to define usually for all fields.
php yii2 yii2-validation yii2-model
Siva.G γ
source share