question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

validateField not working

See original GitHub issue

🐛 Bug report

When calling validateField the field is not validated

Current Behavior

Here is a repository to checkout and click the button labeled “Next Step” which is supposed to validate field “email” https://github.com/cyberprodigy/formik-single-field-validation-bug

Expected behavior

When the method validateField is called it should display that the field is required

Reproducible example

Checkout https://github.com/cyberprodigy/formik-single-field-validation-bug execute `npm start`` Observe that no validation is happening

Suggested solution(s)

It should display the error when validateField is invoked. You can trigger focus() followed by blur() to obtain the desired behaviour, but that is not a solution

Additional context

Your environment

Software Version(s)
Formik 1.5.8
React 16.9.0
TypeScript
Browser
npm/Yarn
Operating System Mac Mojave

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
mr-newellcommented, Mar 13, 2020

Also running into this in a form with a validationSchema but no validate.

2reactions
jamesmosiercommented, Aug 23, 2019

Looks like if there is no validate function on a field, it just calls Promise.resolve() https://github.com/jaredpalmer/formik/blob/master/src/Formik.tsx#L426

Also the full TypeError is "_this.fields[field].props.validate is not a function"

Read more comments on GitHub >

github_iconTop Results From Across the Web

Formik validation not working for my custom react-places ...
I have the following component that makes a form and use formik for form validation and has a custom input field created with...
Read more >
NetSuite Applications Suite - ValidateField Sample
The ValidateField function is called whenever the user changes the value of a field. This function returns false to reject the value.
Read more >
Client Script Validate Field Function - validateField - SuiteRep
The purpose of the client script validate field function is to control what can and can't be entered in a certain field.
Read more >
unable to validate field mapping - Informatica Network
Hi , I am working on course 101 and I am not able to validate any of the field mappings in Data Synchronization...
Read more >
validate-field - CodeSandbox
Console · Problems · React DevTools.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found