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

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


Your validations structure should mirror object(s) in data, thus it should be:

validations: {  internalFormData: {    password: {      required,      minLength: minLength(8)    },    repassword: {      required,      minLength: minLength(8),      sameAs: sameAs('internalFormData.password')    }  }}


You need to point out your nested attribute with a function. Like this :

data(){return { password :{  new: '',  newRepeated:'' }}},    validations : { password: {  new : {required},  newRepeated : {   required,   sameAs : sameAs( function(){return this.password.new} )  } }}

I would also suggest you to take a look at this closed issue.https://github.com/vuelidate/vuelidate/issues/252