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

Record-level validation issues when fields use validateFields={[]} #316

Open
powah opened this issue Aug 13, 2018 · 3 comments
Open

Record-level validation issues when fields use validateFields={[]} #316

powah opened this issue Aug 13, 2018 · 3 comments

Comments

@powah
Copy link

powah commented Aug 13, 2018

Are you submitting a bug report or a feature request?

bug report.

What is the current behavior?

After validate function returns an error for the field it's not cleared even the error is fixed later.

What is the expected behavior?

It should clear stale errors.

Sandbox Link

I created a simple sandbox to showcase the issue. To reproduce, first enter let's say a number 3 in the first field and number 1 in the second one. You will get an error that field1 must be lower than field2. Then edit field2 to have a value bigger then field1 but the error remains despite the fact that validate function is triggered each time.

https://codesandbox.io/s/zk6my5klx

What's your environment?

Latest versions of the lib (visible in codesandbox deps)

Other information

I think this is an issue because form fields usually don't know about each other and the relations/logic between them as they often reside in different components but the form validation function (or some other container component) does.

@erikras
Copy link
Member

erikras commented Aug 13, 2018

This is exactly what the validateFields prop is for. If you specify validateFields={['field1']} for the second field, it works. By setting validateFields={[]}, you are saying, "Don't run the validation for any other field when this one changes."

@powah
Copy link
Author

powah commented Aug 13, 2018

I know that but I am talking about form level validation which should not rely on validateFields prop. If I'm wrong why validation is run first time at all?

@matkrzy
Copy link

matkrzy commented Apr 29, 2020

@erikras any advice for this?

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

3 participants