I am using Veevalidate version 2. The documentation is either broken or not useful. I am trying to use multiple errors on the field but it only displays one. What am I missing? Here is my code:
Vue.use(VeeValidate, {
fastExit: false
});
Validator.extend("number", {
getMessage: (field) =>
"Error 1",
validate: (value) => {
if (/^[^-][0-9]+|[.][0-9]+/) {
return true;
} else {
return false;
}
},
});
Validator.extend("number2", {
getMessage: (field) =>
"The field is required",
validate: (value) => {
if (value == '') {
return false;
} else {
return true;
}
},
});
<input
class="ff"
v-validate="'number|number2|required'"
v-model="application.number"
/>
</div>
<span v-show="errors.has('number')" class="error">
{{
errors.first("number")
}}
</span>
<span v-show="errors.has('number2')" class="error">
{{
errors.first("number2")
}}
</span>
number2
? – Adam OrłowskiValidator.extend("number2"
– localhostnumber
ornumber2
or random? – Utsav Patelv-show
onnumber2
. So my question is are you sure, thenumber2
error should be displayed? Is there anerror
fornumber2
in Veevalidates error bag? – Adam Orłowskinumber
it is like it is ignoringnumber2
and keeping old copy ofnumber
error message even after I comment it out – localhost