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

Add new Form prop to scroll to first error #21442

Closed
1 task done
Kamahl19 opened this issue Feb 18, 2020 · 1 comment
Closed
1 task done

Add new Form prop to scroll to first error #21442

Kamahl19 opened this issue Feb 18, 2020 · 1 comment
Assignees
Labels

Comments

@Kamahl19
Copy link
Contributor

Kamahl19 commented Feb 18, 2020

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

What problem does this feature solve?

It would be great if we can declaratively say that we want the form to scroll to first error after submitting. Currently we need to do this:

  1. create Form instance manually
const [form] = Form.useForm();
  1. create onFinishFailed
const onFinishFailed = ({ errorFields }) => {
    form.scrollToField(errorFields[0].name);
};
  1. set form and onFinishFailed manually
<Form form={form} onFinishFailed={onFinishFailed} />

What does the proposed API look like?

We can have a prop for this like this:

<Form scrollToFirstError />
@zombieJ
Copy link
Member

zombieJ commented Feb 19, 2020

LGTM

@zombieJ zombieJ added 4.x In Ant Design 4.0 improvement improve some features labels Feb 19, 2020
@zombieJ zombieJ self-assigned this Feb 19, 2020
@afc163 afc163 closed this as completed Feb 19, 2020
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

3 participants