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

Form-level validation #19078

Closed
1 task done
chiubaka opened this issue Oct 1, 2019 · 1 comment
Closed
1 task done

Form-level validation #19078

chiubaka opened this issue Oct 1, 2019 · 1 comment
Assignees

Comments

@chiubaka
Copy link

chiubaka commented Oct 1, 2019

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

What problem does this feature solve?

Sometimes you want to validate the entire collection of a form's fields together (e.g. to validate that the data makes sense together, not just that an individual field is valid).

Currently this appears to be loosely possible if one wraps a Form.create and hooks into onValuesChange, but this is a rather involved hack, and doesn't feel like it treats form-level validation as a first-class feature.

Not having something like this is pushing me towards something heavier like Formik, which I thought I could avoid (I do like the existing Antd Form API).

What does the proposed API look like?

Pass a set of custom validation rules to the Form component. Validation rules would look similar to field-level validation rules, but would receive all values of the form. Errors could be displayed either above or below the form.

@zombieJ
Copy link
Member

zombieJ commented Oct 2, 2019

Thanks for feedback.

In v3, you can ref register demo for related fields validation. Which may little complex but easier than onFieldsChange.

In v4, yes, we provides dependencies to connect validation.

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