sameAs doesn't work
Author: GalacticHypernovaCreated Dec 11, 2023Updated Feb 25, 2025
Labelsbug2.0
Describe the bug Using sameAs according to the documentation doesn't seem to work, not as a string and not as a ref.
Reproduction URL This can be seen in any composition API project that uses vuelidate sameAs (specifically tested with Nuxt 3.8.2) Didn't have time to make a reproduction as I'm currently not home, if needed I'll gladly provide it when I get the chance.
To Reproduce Steps to reproduce the behavior:
- Create a useVuelidate instance:
const form=reactive({
f1:'',
f2:''
})
const v$=useVuelidate(
{
f1:{required},
f2:{sameAsF1:sameAs('f1')
}
})- Try to complete a form with these validations
- F2 field is always red (meaning invalid) even when it's the same as F1 (tested with aaaaaaaa, 12345678)
Expected behavior sameAs should work correctly.
Screenshots Inapplicable, the red outline is simply a design choice of mine, adding any sort of color to it will prompt it.
Additional context
Source: vuelidate/vuelidate