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

removeHiddenData已经设置为false,表单的提交数据还是没有hidden字段的默认值 #1464

Closed
capTimi opened this issue Jan 9, 2024 · 1 comment
Assignees

Comments

@capTimi
Copy link

capTimi commented Jan 9, 2024

1.依赖仓库的版本(Dependencies versions)

  • react:16.9.0
  • form-render:2.3.8
  • antd:5.12.8

2.问题描述(Bug description)
removeHiddenData已经设置为false,但表单的提交数据还是没有hidden字段的默认值(default),试过使用form.getValues(true)和form.getHiddenValues(),也拿不到hidden的默认值(default),详见下方demo。
举例的schema中 type字段的hidden为true,default值为4,但在表单提交的时候只有schema中source字段的值

3.出现问题的 schema demo(Reproduction schema demo)

const schema = {
  type: "object",
  properties: {
    arg1: {
      description: "",
      title: "arg1",
      type: "object",
      properties: {
        type: {
          default: "4",
          description: "",
          title: "type",
          type: "string",
          hidden: true,
        },

        source: {
          default: "test",
          description: "",
          title: "source",
          type: "string",
        },
      },
      required: [],
    },
  },
  required: [],
}

4.最小复现 demo(Reproduction demo)

https://codesandbox.io/p/sandbox/trusting-panka-forked-hj8q4p?file=%2Fsrc%2FApp.js

@capTimi capTimi changed the title removeHiddenData已经设置为false,表单的提交数据还是没有hidden的value removeHiddenData已经设置为false,表单的提交数据还是没有hidden的默认值value Jan 10, 2024
@capTimi capTimi changed the title removeHiddenData已经设置为false,表单的提交数据还是没有hidden的默认值value removeHiddenData已经设置为false,表单的提交数据还是没有hidden字段的默认值 Jan 10, 2024
@lhbxs
Copy link
Collaborator

lhbxs commented Jan 13, 2024

确实,你这种比较极端。default 根本就没有被写入 form 表单里面,如果是一开始显示,后面隐藏。或者是通过 setValues 被赋过初始值就不会出现这个问题,直接 hidden,还有搜集 default 这确实,怎么说呢

@lhbxs lhbxs closed this as completed Mar 22, 2024
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

2 participants