ant-design / ant-design/pro-components

表单在编辑的时候如果清除了某个字段的值,在提交的时候这个字段都会被过滤掉,导致保存失败🐛[BUG]

Open
#8,203 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

### 🐛 bug 描述

在Schema Form - JSON 表单或antd普通表单中,编辑时将某个有值的字段清空,那么在点onFinish的时候这个被清空的字段会被过滤掉,这样就会在提交到后端的时候这个字段被认为是未做修改的。所以是不是可以考虑表单中的字段不管有没有值都保留字段?

### 📷 复现步骤

如官网https://procomponents.ant.design/components/schema-form的 示例

### 🏞 期望结果

表单中的字段不管有没有值都保留字段?或者有什么方法能解决呢?

### 💻 复现代码

官网https://procomponents.ant.design/components/schema-form的 示例

### © 版本信息

- ProComponents 版本: [e.g. 4.0.0]
- umi 版本
- 浏览器环境
- 开发环境 [e.g. mac OS]

以上版本信息随便都行

### 🚑 其他信息
默认这个是有值的
![image](https://github.com/ant-design/pro-components/assets/18113970/d3c46a43-6352-4eff-8a76-5caf2aae44d4)

把这2个字段值清除之后点提交时这2个字段就被过滤掉了
![image](https://github.com/ant-design/pro-components/assets/18113970/abcda5ad-9e7d-4442-a168-db32ff2aabc7)

Contributor guide

Open the contributing guide

Research direction

Start with the Schema Form example at https://procomponents.ant.design/components/schema-form and inspect the onFinish payload after clearing previously populated fields. Confirm whether cleared fields are omitted in both Schema Form and ordinary antd forms; done means the expected empty-field values are retained or the supported resolution is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.