小编EM_*_*M_A的帖子

粘贴值后反应钩子表单验证不起作用

我为表单创建了一个模型,该模型通过它进行映射以使用react-hook-form创建表单

当我第一次提交表格时,一切都很好。但在其他时候,当我将值粘贴到输入中时,验证无法正常工作(它显示所需的错误,但输入不为空)

这是模型:

export const formData = [
  {
    id: 1,
    type: "text",
    labelRequired: true,
    label: "name",
    shape: "inline",
    placeholder: "name",
    name: "nameOne",
    validation: {
      required: true,
      minLength: 8,
    },
    size: 6,
  },
  {
    id: 2,
    type: "text",
    labelRequired: true,
    label: "family",
    shape: "inline",
    placeholder: "family",
    name: "nameTwo",
    validation: {
      required: true,
      minLength: 8,
    },
    size: 6,
  },
  {
    id: 7,
    type: "checkbox",
    label: "Sample",
    shape: "checkbox",
    placeholder: "placeholder",
    name: "checkbox_btn",
    data: [
      {
        id: 41,
        inputId: "inline-form-1",
        label: "1", …
Run Code Online (Sandbox Code Playgroud)

reactjs react-hooks react-hook-form

7
推荐指数
1
解决办法
1554
查看次数

标签 统计

react-hook-form ×1

react-hooks ×1

reactjs ×1