Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vee-validate error message don't have the field name

Tags:

vee-validate

I am trying to get a hand of vee-validate 3. A lot has changed on version 3. Problem is the error messages do not have the specific field name. Below is the code that i have in a laravel blade file:

<validation-provider rules="email" v-slot="{ errors }">
<input type="text" 
class="input" 
name="email"
v-model="email">
<span>@{{ errors[0] }}</span>
</validation-provider>

When i strart typing in the input field, the error message prints inside the span tags, but it does not have the field name, rather a generic 'field', such as below:

{field} is not valid.

Anybody knows how to get this working?

Thanks,

like image 411
Yeasir Arafat Majumder Avatar asked Sep 19 '25 15:09

Yeasir Arafat Majumder


1 Answers

I found it in the docs. All you need to do is add a name property to the validation-provider component like below:

<validation-provider rules="email" name="...add_input_field_name_here..." v-slot="{ errors }">
like image 143
Yeasir Arafat Majumder Avatar answered Sep 23 '25 13:09

Yeasir Arafat Majumder