Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.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
Reactjs rest引用输入上的管理用于编辑,但不用于创建_Reactjs_Admin On Rest - Fatal编程技术网

Reactjs rest引用输入上的管理用于编辑,但不用于创建

Reactjs rest引用输入上的管理用于编辑,但不用于创建,reactjs,admin-on-rest,Reactjs,Admin On Rest,出于某种原因,ReferenceInput在我的编辑表单上运行良好;但在createform上,它显示为disabled和empty(我对这两个表单使用相同的代码)。它也没有显示chrome开发工具中的任何错误。我是否需要为创建表单做其他工作?谢谢这对我有用。请注意参考输入中的“allowEmpty” <Create title="My title" {...props}> <SimpleForm> <TextInput label= "fi

出于某种原因,ReferenceInput在我的编辑表单上运行良好;但在createform上,它显示为disabled和empty(我对这两个表单使用相同的代码)。它也没有显示chrome开发工具中的任何错误。我是否需要为创建表单做其他工作?谢谢

这对我有用。请注意参考输入中的“allowEmpty”

<Create title="My title" {...props}>
    <SimpleForm>
        <TextInput label= "field 1" source="f1"  validate={[ required, minLength(3), maxLength(20) ]} />
        <ReferenceInput label="field 2" source="f2" validate={[ required ]} reference="reference1" allowEmpty>
            <AutocompleteInput optionText="f3" />
        </ReferenceInput>
    </SimpleForm>
</Create>


请共享您的代码您可能需要在中设置allowEmpty on referenceInputcreate@kunalpareek啊哈,那是真的,我想要么这样,要么设置默认值。应该在文件中提到。谢谢:)