Cross-field rule
<input
id="confirm-password"
name="confirmPassword"
type="password"
required
data-validate="same-as"
data-same-as="#password"
/>
Custom demo
Password confirmation with a custom same-as rule and custom error copy.
The confirmation field opts into a custom rule and the validator supplies the product-specific message.
<input
id="confirm-password"
name="confirmPassword"
type="password"
required
data-validate="same-as"
data-same-as="#password"
/>
new A11yFormValidator(form, {
...createDefaultPreset(),
messages: {
sameAs: "Use the same password in both fields."
}
});