其余管理员引用输入适用于编辑,但不适用于创建



出于某种原因,ReferenceInput在我的编辑表单上工作正常;但在创建表单上,它显示为禁用和空(我对两个表单使用相同的代码(。它也不会在 chrome 开发工具中显示任何错误。我是否必须执行任何其他操作才能使"创建"表单正常工作?谢谢

这对我有用。注意引用输入中的"允许空">

<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>

相关内容

最新更新