Repeat Password doesn't work
cgahmann opened this issue · comments
On the Example page the "Repeat your password" field does not work. https://just-validate.dev/examples/
The problem is that fields['#example2_password'] doesn't exist. It exists only fields['2'] etc:
.addField('#example2_repeat-password', [
{
rule: 'required',
},
{
validator: (value, fields) => {
if (
fields['#example2_password'] &&
fields['#example2_password'].elem
) {
const repeatPasswordValue =
fields['#example2_password'].elem.value;
return value === repeatPasswordValue;
}
return true;
},
errorMessage: 'Passwords should be the same',
},
])
And there's a typo error at "Quick start" under "Also it is possible to use a DOM element as a field in the .addField() method." There is one "]);" too much at the end: https://just-validate.dev/documentation/#section-2
Thanks for the catch, fixed! Also adjusted the docs.