Open damianchojna opened 3 years ago
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days
I have same issue
The default ErrorMessage component does not display errors until a user has "touched" the field, aka focused or un-focused the field. You can trigger this in code via setTouched() or setFieldTouched(fieldName, true). Calling submitForm will automatically set all fields touched.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 60 days
Heya, This problem is related to #2345. I first of all thought it might be a bug because I expected the field to be touched
when I manually call validateForm
. I figured out that if you are using a multi-stage form then Formiik will have no real idea which fields to set as touched
which makes sense as to why you have to call setTouched
manually.
I suggest that something get added to the validation.md
guide to alert users of this library that you will have to call setTouched
manually on fields in this situation. I'll have a play to see if I can find a neat way to do it and then look to submit something to add this to the documentation.
i have same issue, and because i do not add require validation(i used yup to validate)ðŸ˜
Current Behavior
After executing the
validateForm
method, I don't see any errorsExpected behavior
After executing the
validateForm
method, form errors should appearReproducible example
Click button "validate form" https://codesandbox.io/s/formik-validatefieldwithschema-6witd
example from: https://github.com/formium/formik/blob/master/examples/ValidateFieldWithSchema.js