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

Validation behavior with dependent fields #4311

Open
4 tasks done
BlackBerryID opened this issue Sep 23, 2024 · 1 comment
Open
4 tasks done

Validation behavior with dependent fields #4311

BlackBerryID opened this issue Sep 23, 2024 · 1 comment

Comments

@BlackBerryID
Copy link

Prerequisites

What theme are you using?

core

Version

5.21.1

Current Behavior

onSubmit: validate all fields
onChange: dependent fields aren't validated (as a result these fields loose error state)

Expected Behavior

onChange doesn't make dependent fields with errors loose thier error state if they haven't been changed

Steps To Reproduce

  1. Open example: https://playcode.io/2018348
  2. Choose yes in "showSecondBlock" field
  3. Click on submit button (secondBlock's fileds got errors)
  4. Go to "name" field of firstBlock object
  5. Type some text (secondBlock's fields loose thier errors)

Environment

No response

Anything else?

No response

@BlackBerryID BlackBerryID added bug needs triage Initial label given, to be assigned correct labels and assigned labels Sep 23, 2024
@nickgros
Copy link
Contributor

@BlackBerryID I don't see the same issue in this equivalent playground example

Does the issue still happen if you treat the Form component as fully controlled? i.e. store formData in a useState and update it using the onChange prop

@nickgros nickgros added awaiting response and removed needs triage Initial label given, to be assigned correct labels and assigned labels Sep 27, 2024
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