G
G
gooseNjuice()2019-06-10 17:25:13
Validation
gooseNjuice(), 2019-06-10 17:25:13

How to implement password comparison with Formsy-React?

This is my first time using a form library, and here's the question I had: How to check for a match between the values ​​of two inputs with passwords and pass an error to prop.validationErrors in the corresponding FormsyInput instances (there are more fields in the form)?

<FormsyInput
            name="password.enter"
            type="password"
            validations="minLength:6"
            required
          />
          <FormsyInput
            name="password.confirm"
            type="password"
            validations="minLength:6"
            required
          />

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Sviridov, 2019-06-11
@gooseNjuice

Here is an example that should help you:

<MyInput name="number" validations={{
  myCustomIsFiveValidation: function (values, value) {
    values; // Вот тут, по идее, есть значения других полей
    value; // 5
    return 5 === value ? true : 'No five'; // You can return an error
  }
}}/>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question