Using validationSchema returns empty errors object
See original GitHub issue🐛 Bug report
Current Behavior
I threw together a quick codesandbox to prototype a concept, and my Yup-based validationSchema
always resulted in an empty errors
object on submit.
I jumped into the official Formik codesandbox playground and realized the same thing was happening:
Expected behavior
I would have expected { errors: { email: 'Required' } }
but perhaps I’m missing something.
Your environment
Software | Version(s) |
---|---|
Formik | 1.2.0 |
React | 16.5.0 |
Yup | 0.26.3 (0.26.6 on my sandbox) |
TypeScript | |
Browser | Firefox, 63.0.3 |
npm/Yarn | |
Operating System |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:25
- Comments:32 (6 by maintainers)
Top Results From Across the Web
Formik errors object is not being updated properly on input
Formik is already handling field change and field blur with the handleChange and handleBlur handlers so it is already making validation checks.
Read more >Validation - Formik
Formik is designed to manage forms with complex validation with ease. Formik supports synchronous and asynchronous form-level and field-level validation.
Read more >Easy Error Handling and Data Validation with Yup - Code Daily
Our Formik values are in the shape of an object . ... Formik knows how to map the errors returned from yup to...
Read more >17.7.0 API Reference - joi.dev
Validates a value against a schema, returns valid object, and throws if validation fails where: value - the value to validate. schema -...
Read more >How to use Yup context variables in Formik validation
... return errors; }, {}); } return {}; } });. Formik natively supports Yup validation objects, which are passed in as validationSchema, or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jaredpalmer this still seems to be an issue. Upgrading to the latest version of formik in the sandbox example doesn’t seem to help either 😕
I set
initialValues
with default values on my object but it is not working for me neither. I useany news on this issue @jaredpalmer ?