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

Depend Form.Item validation ignore Form.validationTrigger="onSubmit" #26949

Open
1 task done
POSTAL5532 opened this issue Sep 29, 2020 · 0 comments
Open
1 task done
Labels

Comments

@POSTAL5532
Copy link

POSTAL5532 commented Sep 29, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. set Form validationTrigger = "onSubmit"
  2. add 2 fields to the form, the second field must be dependent on the first (<Form.Item name="secondItem" dependencies={["firstItem"]}>...</Form.Item>)
  3. add a validation rule for the 2nd field (for example "required")
  4. enter and then delete data in the second field
  5. enter data in the first field

What is expected?

Validation for the second field is triggered only after submitting the form

What is actually happening?

Validation for the second field is triggered immediately after editing the first field (provided that the first field was touched)

Environment Info
antd 4.6.6
React React v16.13.1
System Windows 7
Browser Google Chrome 83.0.4103.61

If this behavior is initially valid, then it would be more logical to allow control over the validation of dependent fields using the 'validateTrigger' parameter in the Rule object, which will take precedence over the 'validateTrigger' parameter in the Form.

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

No branches or pull requests

2 participants