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

calling validateField() on nested field throws error "can't access property "validate", fieldRegistry.current[name] is undefined" #3677

Open
john1625b opened this issue Oct 24, 2022 · 1 comment

Comments

@john1625b
Copy link

Bug report

Current Behavior

  • when you call validateField on a nested field, it throws the error can't access property "validate", fieldRegistry.current[name] is undefined
  • This error does not show up with, setFieldTouched

Expected behavior

  • validateField should add the error nested under the appropriate object in the errors object

Reproducible example

See in this example, click into the face field that click away and see that it throws an error because of validateField
https://codesandbox.io/s/formik-example-forked-vqwnm3?file=/index.js

Suggested solution(s)

handle the validation case when the fields are nested. In my scenario I have to use the validateField function

Your environment

Software Version(s)
Formik 2.2.5
React 16.13.1
TypeScript 4.0.2
Browser Google Chrome Version 106.0.5249.119 (Official Build) (arm64)
npm/Yarn
Operating System Macos Monterey
@Adrian397
Copy link

Have the same issue. Still hasn't been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants