Imagine having a Vue component with data structured like this:
data: () => ({
form: {
old_password: {
data: '',
type: 'password',
label: 'Old Password',
},
new_password: {
data: '',
type: 'password',
label: 'New Password',
},
repeat_password: {
data: '',
type: 'password',
label: 'New Password Confirmation',
},
},
}),
The reason for this specific data format is due to utilizing the ant-design plugin for form building, leaving no room for alternative formats. The data
field will hold the actual information.
Moreover, there are validation rules in place for vuelidate as follows:
validations: {
form: {
old_password: {
data: { required },
},
new_password: {
data: { required },
},
repeat_password: {
data: { sameAsPassword: sameAs('new_password') },
},
},
},
Although the required
rule functions correctly, the sameAsPassword
rule seems faulty. It consistently displays an error even when using identical passwords. It appears that the comparison is not being made against the correct field. How can I adjust the rule to compare it accurately?