Questions tagged [vuelidate]

Use this tag to ask questions related to the validation library vuelidate.

Vuelidate is a simple, lightweight model-based validation for Vue.js 2.0

348 questions
24
votes
2 answers

Vuelidate: validate form with sub components

How to work with validations of nested components inside a parent component with Vuelidate? I would like to change parentForm.$invalid if inputs in subcomponents are valid or not. Parent:
Flora
  • 533
  • 1
  • 8
  • 19
20
votes
4 answers

Vuelidate: validate on click, not when field touched

I'm kinda new to vuelidate, and everything works fine, except I have no clue how to run validation only when the button Submit has been clicked. Right now it marks touched field red when you start providing any input and I'd like it to wait with…
nemezis
  • 203
  • 1
  • 2
  • 4
14
votes
2 answers

Vue-test-utils: using $nextTick multiple times in a single test

I'm writing unit tests for vuelidate validation in my component. I figured out that the $touch() method is called asynchronously, so I need to use $nextTick() for the expect(). The problem appears when I need two nextTick()s for two…
Fidd
  • 722
  • 1
  • 8
  • 20
14
votes
3 answers

How do I dynamically set validations fields in vuelidate

I'm using VueJS2 with vuelidate library. I can validate the fields based on the validation objects. The validation will execute during computed time. But My validations objects is fixed, instead of dynamic. I have some fields will hide based on the…
Abel
  • 1,494
  • 3
  • 21
  • 32
12
votes
2 answers

Vuelidate checking for true/false

I have a custom checkbox The true/false value toggles fine { "first_name": "", "last_name": "", "username": "", "email": "", "terms_accepted": true } How do I validate for a true value? at the moment I…
LeBlaireau
  • 17,133
  • 33
  • 112
  • 192
10
votes
2 answers

How to validate password with Vuelidate?

Greeting, i need to validate the password form In addition to the field required Must have at least one uppercase letter, lowercase letter at least, number at least one and at least one of the following characters "#?! @ $% ^ & * -" I am using this…
TEtet
  • 129
  • 1
  • 9
9
votes
2 answers

How to initialise Vuelidate 2.0.0 when testing a Vue component with Vitest?

In my Vue 2.7.14 app I'm using Vuelidate 2.0.0. I'm trying to migrate a test from Jest to Vitest, but the v$ object is not initialised correctly in the latter case. The component has a checkbox bound to formData.accepted validations () { …
Dónal
  • 185,044
  • 174
  • 569
  • 824
9
votes
3 answers

Does Vuelidate support typescript in VueJs?

Does Vuelidate support typescript in VueJs? If yes, how to use? I am able to use it with JavaScript.
Ajay Agrawal
  • 145
  • 2
  • 10
9
votes
8 answers

Why doesn't it work when sameAs is used in vuelidate?

fieldName not found to vuelidate of sameAs method. sameAs(blabla) blabla = 'internalFormData.password', 'internalFormData.password.value', 'this.internalFormData.password', 'this.internalFormData.password.value', 'password', 'this.password',…
Jay Han
  • 91
  • 1
  • 2
9
votes
1 answer

Vuelidate date input field

I hope someone can clarify to me, how to properly use Vuelidate while validating Date object. I want to use the current date as a minimal date, so if a user inputs a date later, an error will be shown. I have an example:…
Cheslav
  • 159
  • 1
  • 2
  • 10
8
votes
2 answers

Vuelidate reset specific field so that $error flag is false

Using Vuelidate you can reset the validation errors by using this.$v.$reset(). In this Codepen example resetting the lastName field that uses a Vuetify component works - $invalid is true while $error is set to false. When resetting the regular text…
bdoubleu
  • 5,568
  • 2
  • 20
  • 53
8
votes
1 answer

Displaying error messages in vuetify when validating nested object with vuelidate

I am using vuelidate to validate my form input and display the error messages using vuetifyjs. I managed to do the basic object validation and am able to show the error messages. However I'm having issues with displaying the error messages when I…
Anima-t3d
  • 3,431
  • 6
  • 38
  • 56
7
votes
2 answers

managing vuelidate validations in vuetify

How are you guys doing validations in Vuetify? I'm not able to wrap my head around very verbose validation syntax. I'm using Vuelidate and as per Vuetify's docs, here is how I'd have to implement a simple required field: Script: import { required }…
pranavjindal999
  • 2,937
  • 2
  • 26
  • 35
6
votes
1 answer

Vuelidate with Vue 3 + vue-class-component + TypeScript

Does anyone know any working example with the mentioned stack? I know Vuelidate is still alpha when it comes to Vue 3, but my guess is if it works with Composition API, then there should be a workaround to make it work with classes. I'm trying the…
Igor Nikiforov
  • 611
  • 1
  • 7
  • 17
6
votes
2 answers

How to set validate rules in vuelidate to have value same as a field of an object?

Let say I have a vue component with data like this: data: () => ({ form: { old_password: { data: '', type: 'password', label: 'Old Password', }, new_password: { data: '', type:…
cytsunny
  • 4,838
  • 15
  • 62
  • 129
1
2 3
23 24