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 has an error formItem stopping the check,and return result #6321

Closed
liyoy opened this issue Aug 15, 2023 · 4 comments
Closed

form has an error formItem stopping the check,and return result #6321

liyoy opened this issue Aug 15, 2023 · 4 comments
Labels
feature pending Need more information to continue

Comments

@liyoy
Copy link

liyoy commented Aug 15, 2023

Version of antd-mobile

5.29.1

What is this feature about?

No response

@liyoy liyoy added the feature label Aug 15, 2023
@19Qingfeng
Copy link
Contributor

单个字段检查失败后停止继续检查么? 有需要的话我可以贡献这个 PR

@IronKinoko
Copy link
Collaborator

需要更清晰的描述信息。

目前我有两种理解

  1. 整个表单遇到某个字段校验错误立即停止校验,并显示错误。

这是不可取的,表单并非一定要按序填写,其他字段也需要独立校验,阻止整个表单并不合理
换一种思路,把你可以通过 onFinishFailed 收集提交时的错误信息,按需显示

<Form hasFeedback={false} onFinishFailed={({ values, errorFields, outOfDate })=>{
  // 关闭FeedBack,自行处理 errorFields 信息
}}>
</Form>
  1. 单个字段有多个规则,当某一规则校验不通过时,停止剩下的规则的校验

目前已有该功能,设置 validateFirst 既可

<Form.Item validateFirst rules={[{ required: true }, { max: 5, min: 1, type: 'number' }]}>
</Form.Item>

@IronKinoko IronKinoko added the pending Need more information to continue label Sep 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2023

Hi, liyoy.

It seems that this issue is a bit vague and lacks some necessary information. It is recommended to read How To Ask Questions The Smart Way.

看起来这条 issue 描述得有些模糊,缺少一些必要的信息,推荐阅读一下提问指引

@github-actions
Copy link
Contributor

This issue will be closed automatically due to being inactive for a long time.

由于较长时间没有更新,此 issue 将自动关闭。

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature pending Need more information to continue
Projects
None yet
Development

No branches or pull requests

3 participants