#How to validate password and confirm password with useForm?

6 messages · Page 1 of 1 (latest)

ocean hornet
#

Hi, I'm trying to create a change password form. So far everything is working, but I'm having some difficulties validating the confirm password input. I'm trying to get an error in the confirm password input if the user changes the new password input. Apparently the validateOnInputChange only works for that particular input, no the entire form...

Tried with useEffect, but it only made a loop as the only dependency that is asking me is the form itself.

    initialValues: {
      currentPassword: '',
      newPassword: '',
      confirmPassword: '',
    },
    validateInputOnChange: true,

    validate: {
      newPassword: (value) => !meetReq(value),
      confirmPassword: (value, values) =>
        value === values.newPassword ? null : 'invalid password',
    },
  });
ocean hornet
#

Nop, it doesn't... Already tried that... It's having the same behavior.

final cliff
ocean hornet
#

That works, but getting this warning..

final cliff
#

Yeah, just add an eslint ignore