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

表单validateFields行为疑问 #2588

Open
TSjianjiao opened this issue Sep 12, 2024 · 3 comments · May be fixed by #2595 or #2772
Open

表单validateFields行为疑问 #2588

TSjianjiao opened this issue Sep 12, 2024 · 3 comments · May be fixed by #2595 or #2772
Assignees

Comments

@TSjianjiao
Copy link

NutUI React 包名

@nutui/nutui-react

NutUI React 版本号

2.6.18

平台

weapp

重现链接

https://codesandbox.io/p/devbox/bold-rain-grftzx?workspaceId=98e5ebf6-9ed7-4578-a09a-764843a9eb8f

重现步骤

  1. 点击“提交”按钮,三个表单字段出现错误提示
  2. 点击“填充值”按钮,第二个表单填充了值,但是错误信息并没有消失

期望的结果是什么?

第二个表单错误应该消失

实际的结果是什么?

第二个表单错误没有消失

环境信息

No response

其他补充信息

不知道是否是故意这样设计的,我看源码中errs通过判断长度来清空表单项的错误,但是如果前一个被验证的表单项有错误(也就是errs长度不为0),后续的表单项即使没有错误也不会清空状态

@JieJieeee
Copy link

我也遇到这个问题,目前是在第二次setFieldsValue手动validateFields一次以清楚错误信息。期待官方fix一下

@overcastsky
Copy link

overcastsky commented Sep 13, 2024

我也遇到这个问题,手动setFieldsValue之后会触发所有表单的必填校验,当前标表单已设置校验实际为onBlur

@oasis-cloud oasis-cloud self-assigned this Sep 13, 2024
@ryangopher
Copy link

@oasis-cloud Any update?

@jdf2e jdf2e deleted a comment from overcastsky Sep 29, 2024
@oasis-cloud oasis-cloud linked a pull request Nov 5, 2024 that will close this issue
@oasis-cloud oasis-cloud linked a pull request Nov 21, 2024 that will close this issue
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants