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

<Field /> & <FastField /> should have validateOnChange & validateOnBlur settings #1044

Open
maxmantz opened this issue Oct 25, 2018 · 6 comments

Comments

@maxmantz
Copy link

maxmantz commented Oct 25, 2018

🐛 Feature request

Current Behavior

<FastField /> & <Field /> don't have validateOnChange & validateOnBlur settings.

Expected behavior

Setting validateOnChange & validateOnBlur on <Field /> or <FastField /> should override global form settings.

Reproducible example

https://codesandbox.io/s/3q55883491

Suggested solution(s)

Make props validateOnChange & validateOnBlur available for <Field /> & <FastField />.

Additional context

This may or may not be a bug. I'm using Typescript and I don't get an error message when I set validateOnBlur or validateOnChange on <FastField />. Does this mean these props already exist, but don't work?

Your environment

Software Version(s)
Formik 1.3.1
React 16.5.0
TypeScript 3.1.2
Browser Chrome
@maxmantz maxmantz changed the title <Field /> & <FastField /> should have validateOnChange & validateOnBlurSettings <Field /> & <FastField /> should have validateOnChange & validateOnBlur settings Oct 25, 2018
@stale stale bot added the stale label Feb 6, 2019
@c10b10
Copy link

c10b10 commented Feb 22, 2019

What is the best way of doing this with the current api?

@stale stale bot removed the stale label Feb 22, 2019
@stale stale bot added the stale label Apr 23, 2019
@dunk
Copy link

dunk commented May 1, 2019

Yes, I could really do with this, too. For instance: on a normal text input you likely want validation onBlur, but with a select or a radio button onChange is much more appropriate.

@stale stale bot removed the stale label May 1, 2019
@Ericnr
Copy link

Ericnr commented May 2, 2019

Bump for this, would be nice to validate password/confirm password to be the same onChange and other fields after submit only

@stale stale bot added the stale label Jul 1, 2019
@shandysulen
Copy link

Another bump for this. Has there been any progress regarding this enhancement?

@stale stale bot removed the stale label Sep 28, 2019
@stale stale bot added the stale label Nov 27, 2019
@youngchingjui
Copy link

Hello, yes adding another bump here.

My use case: On account registration, we have following basic fields:

  1. Name
  2. Company
  3. Email
  4. Password
  5. Confirm password

We'd like to validate the form on submit for fields 1 - 3 & 5.
We'd like to validate the password field with onChange, so we can show a dynamic password strength meter.

@developer-collin
Copy link

developer-collin commented Mar 15, 2022

Would find this feature very useful as well. Use case being similar to others.

For text-like inputs validation onBlur is often a better UX than onChange, as changing errors states mid-typing can be jarring. While onBlur in those cases show the user-intention to be done, making validation at that point timely.

For checkboxes and radios, we want validation onChange, as we know the user interaction is already complete, while onBlur may not take place in a timely manor, leaving a user without feedback.

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

8 participants