Problem when trying to validate with Vuelidade #140
Unanswered
douglas-88
asked this question in
Q&A
Replies: 1 comment 4 replies
-
You could use regex validator to validate masked value? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I have a form that I use vuelidate to validate (https://vuelidate-next.netlify.app/) .
And I can also make the mask work in the fields using the plugin (https://beholdr.github.io/maska/#/?id=live-demo) .
I'm on vue 3 .
The problem is that, for example, there is a field called "cnpj" with 14 digits, and I can never validate it, because the mask adds characters, and then it becomes 18 digits...
Is there a way to pass the raw value to vuelidate to validate correctly?
Esse é meu código:
<div class="row"> <div class="col-4"> <label for="cnpj" class="form-label">CNPJ:</label> <input v-maska data-maska="##.###.###/####-##" type="text" id="cnpj" name="cnpj" class="form-control" :class="this.v$.cnpj.$invalid ? 'is-invalid' : 'is-valid'" v-model="cnpj"> <div :class="this.v$.cnpj.$invalid ? 'invalid-feedback' : 'valid-feedback'" v-for="erros in this.v$.cnpj.$errors"> {{erros.$message}} </div> <br> </div>
Forgive my writing, as I'm using Google Translate.
Beta Was this translation helpful? Give feedback.
All reactions