You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know formik.resetForm() resets all values to the initial values. But is there something like formik.touchAllFields()?
Use case:
When I hit submit on my form, I want all my fields to show a "required field" error for fields that are unfilled. Currently hitting submit validates the whole form and sets the error values but thats not enough since each field checks if its errored and touched.
The other option is manually call .setFieldTouched(...) on all the fields which is especially painful if you have nested values.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I know
formik.resetForm()
resets all values to the initial values. But is there something likeformik.touchAllFields()
?Use case:
When I hit submit on my form, I want all my fields to show a "required field" error for fields that are unfilled. Currently hitting submit validates the whole form and sets the error values but thats not enough since each field checks if its errored and touched.
The other option is manually call .setFieldTouched(...) on all the fields which is especially painful if you have nested values.
Beta Was this translation helpful? Give feedback.
All reactions