Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何向react JS中的选项添加验证?_Javascript_Reactjs_Validation_Formbuilder_React Forms - Fatal编程技术网

Javascript 如何向react JS中的选项添加验证?

Javascript 如何向react JS中的选项添加验证?,javascript,reactjs,validation,formbuilder,react-forms,Javascript,Reactjs,Validation,Formbuilder,React Forms,我有一个动态生成的表单,我必须根据在另一个字段中选择的选项为一个字段添加验证 [{ name: 'Type', label: Labels.Type.id, type: 'select', options: [ 'Date', 'Phone', 'Email', 'Pincode' ], Validations: {

我有一个动态生成的表单,我必须根据在另一个字段中选择的选项为一个字段添加验证

    [{ name: 'Type',
       label: Labels.Type.id,
       type: 'select',
       options: [
            'Date',
            'Phone',
            'Email',
            'Pincode'
       ],
       Validations: {
           required: true,
       },
   },
   {
       name: 'Value',
       label: Labels.Value.id,
       type: 'textbox',
       Validations: {
          required: true,
      },
    },
    ]
在上面的代码片段中,我正在这个模式中生成字段,现在我必须根据在“Type”中选择的值向“Value”添加验证