Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form validation only gets triggered per field #1661

Closed
izzappel opened this issue Jul 9, 2019 · 1 comment
Closed

Form validation only gets triggered per field #1661

izzappel opened this issue Jul 9, 2019 · 1 comment

Comments

@izzappel
Copy link

izzappel commented Jul 9, 2019

🐛 Bug report

I have a form with two fields and a validation logic that is dependent on both. But only the current field error gets mapped to the form state and the form state does not match with the validation logic anymore.

Current Behavior

When one of the fields get changed the validation only gets triggered for that field. This causes wrong state and errors in the form state.

Expected behavior

It only appears on the newest version 2.0.1-rc.10 and I saw the comment in the release. I wanted to be 100% sure if this use case will not be supported in the future.

Reproducible example

https://codesandbox.io/embed/goofy-lumiere-pvb3d

Suggested solution(s)

Having a validation function that always handles the validation on all the values and returns the error object for all the values should be used as is for the form state.
For me personally, it is quite confusing that I am able to define a validation function that return the complete error object but only the field error gets mapped on the form state.
Or do I miss something?

Your environment

Software Version(s)
Formik 2.0.1-rc.10
React 16.8.6
TypeScript -
Browser Chrome
npm/Yarn yarn
Operating System macOS Mojave
@izzappel
Copy link
Author

izzappel commented Jul 9, 2019

Just saw that it is actually the same Problem as this one: #1654. So I will close it, since there is already a fix pushed.

@izzappel izzappel closed this as completed Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant