Open chriskolenko opened 2 years ago
Latest commit: a4f8ef143454c2edf00d65412d72c9b971f06d9a
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
I'm currently having this issue on a project I'm working on. It's great to see that there's a a PR for this. Is there any ETA on a release? Great project btw! :)
I'm using this beforeNext function to do it.
const beforeNext = React.useCallback(
async (
values: FormikValues,
formikBag: FormikProps<FormikValues>
): Promise<any> => {
const validationErrors = await formikBag.validateForm();
if (Object.keys(validationErrors).length > 0) {
formikBag.setTouched(setNestedObjectValues(validationErrors, true));
throw new Error("formik error");
}
},
[]
);
Hi, any solution? i use tailwind. And my code:
`<Field type="text" name="responsibleName" id="responsibleName" autoComplete="given-name" placeholder="Aquí tu nombre completo" className="mt-1 block w-full rounded-md border border-gray-300 py-2 px-3 shadow-sm focus:border-md-pink-500 focus:outline-none focus:ring-md-pink-500 sm:text-sm" /> {touched.responsibleName && errors.responsibleName ? (
) : null}`
I'm using this beforeNext function to do it.
const beforeNext = React.useCallback( async ( values: FormikValues, formikBag: FormikProps<FormikValues> ): Promise<any> => { const validationErrors = await formikBag.validateForm(); if (Object.keys(validationErrors).length > 0) { formikBag.setTouched(setNestedObjectValues(validationErrors, true)); throw new Error("formik error"); } }, [] );
In What File?
When a person doesn't touch all the fields before hitting next. You don't see any error messages unless you touch the field after the form is validated.
See comment on formik here: https://github.com/jaredpalmer/formik/issues/2734#issuecomment-923337541