no such validator 'model_value_goes_here' error
See original GitHub issueVersions:
- VueJs: 2.3.2
- Vee-Validate: 2.0.0-rc2
Description:
Hi,
I’m getting the following error in my console after upgrading to the RC2:
Uncaught anonymous {msg: "[vee-validate]: No such validator 'david@denja.land' exists."}
This is the code we have for that input:
<input
class="form-control input-lg"
type="email"
v-model="email"
name="email"
:placeholder="$t('fields.email')"
:disabled="ajax > 0"
v-validate.initial="email"
data-vv-rules="required|email"
v-bind:data-vv-as="$t('fields.email')">
It seems as it’s not just taking “email” as the validator rule name, but suddenly translates it to the model value? as when I enter my email address, it actually displays the error “no such validator ‘david@email.be’ exists”.
Is this a known issue, or am I overseeing some change of behaviour that now requires us to update how we define the data-vv-rules?
Steps To Reproduce:
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Uncaught Error: [vee-validate] No such validator '1234567' exists
I had a similar error in VeeValidate 3, and the problem is that I forgot to include the rules in the import statement...
Read more >Sign Up - CodePen
<div class="form-group" :class="{'has-error': errors.has('Mobile Number') }" >. 4. <input v-model="register.mobile_number" v-validate="'required'" ...
Read more >Validation Rules - VeeValidate
VeeValidate comes with a bunch of validation rules out of the box and they are ... input for this attribute is used as...
Read more >[vee-validate] No such validator 'not_in' exists. - Bountysource
Uncaught (in promise) Error: [vee-validate] No such validator 'not_in' exists.
Read more >[vee-validate] No such validator '1234567' exists-Vue.js
Coding example for the question Uncaught Error: [vee-validate] No such validator '1234567' exists-Vue.js.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
By default there is no initial validation happening, however if you apply
initial
modifier it will trigger initial value validation, It used to be the opposite but a lot of reasons required this change.data-vv-rules
is considered an alternative way to hold the rules, just for backwards compatibility purposes, the recommended way is to pass them to the directive as an expression, the reason they are being evaluated differently is thatdata-*
attributes are always strings, so there is no room for other types. but the directive expressions can be anything as its evaluated by Vue, so you must pass a valid JS expression, in this case strings need to be enclosed within quotes.The proper way is to remove
.initial
from your templates and it should work properly.okay - I think I’m missing something here. I was thinking that data-vv-rules contained the rules that had to be applied.
What I don’t want is for the initial value to be validated upon loading the input element (why show “email is required” on a login form if the user didn’t already have a chance to enter his/her email address?)
So I thought that
v-validate.initial
overrode the validation rules to be applied to the initial value.Basically - I don’t understand why they would be evaluated differently?
And finally - what’s the proper way now to NOT have the initial value validated, but only have it validated as soon as it’s been touched and/or the form is submitted? I tried doing
v-validate.initial=""
hoping that it would be picked up as “no rules to be applied to the initial value” but an empty list seems to be resulting in the standard sets of validations to be applied.