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

'card'组件以及object类型如何触发表单校验? #1579

Open
12345555666789 opened this issue Nov 5, 2024 · 0 comments
Open

'card'组件以及object类型如何触发表单校验? #1579

12345555666789 opened this issue Nov 5, 2024 · 0 comments
Assignees

Comments

@12345555666789
Copy link

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

  • react:"18.0.0"
  • form-render:"^2.3.6"
  • antd:"^5.6.0"

2.问题描述(Bug description)
放在card组件中的schema表单必填校验不生效
3.出现问题的 schema demo(Reproduction schema demo)

const schema = {
  // ...
{
      "type": "object",
      "widget": "card",
      "column": 0.5,
      "required": true,
      "dependencies": [],
      "rules": [
        {
          "validator": "{{ (_, value) => !!value }}",
          "message": "请填写必填项"
        }
      ],
      "props": {
        "rules": [
          {
            "validator": "{{ (_, value) => !!value }}",
            "message": "请填写必填项"
          }
        ]
      },
      "properties": {
        "$帮助性": {
          "title": "帮助性",
          "required": true,
          "dependencies": [],
          "is_standard_answer": true,
          "displayType": "column",
          "validateTrigger": "onSubmit",
          "rules": [
            {
              "validator": "{{ (_, value) => console.log(value) }}",
              "message": "请填写必填项"
            }
          ],
          "props": {
            "options": [
              {
                "label": "0分",
                "value": "0"
              },
              {
                "label": "1分",
                "value": "1"
              },
              {
                "label": "2分",
                "value": "2"
              },
              {
                "label": "3分",
                "value": "3"
              },
              {
                "label": "4分",
                "value": "4"
              }
            ],
            "optionType": "button",
            "buttonStyle": "solid"
          },
          "widget": "radio",
          "cellSpan": 1
        },
      }
    },
}
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