redux 表单字段警告是否在 Admin 中对剩余输入起作用?
Does redux form field warnings work in Admin on rest inputs?
我指的是以下文档,
Tip: The props you pass to <SimpleForm>
and <TabbedForm>
end up as
reduxForm() parameters. This means that, in addition to validate, you
can also pass warn or asyncValidate functions. Read the reduxForm()
documentation for details.
https://marmelab.com/admin-on-rest/CreateEdit.html#validation
我尝试在字段级别和表单级别定义 warn
属性,但没有显示警告文本。但是,我确实看到 warning
属性 在该字段的 meta
属性 中设置正确。
这是一个错误还是我遗漏了什么?谢谢
示例(字段级别):
const isTest = val => (val === "TEST" ? "Really, TEST?" : undefined);
const PeersCreateEditInputs = (
<SimpleForm>
<TextInput source="ln" label="Name" validate={[required]} warn={isTest} />
....
示例(表单级别):
const isTest = values => {
const warnings = {};
if (values.ln === "TEST") {
warnings.ln = "Hmm, still TEST?";
}
return warnings;
};
const PeersCreateEditInputs = (
<SimpleForm warn={isTest}>
<TextInput source="ln" label="Name" validate={[required]} />
...
找到了,警告通过但不显示。我在 admin-on-rest
存储库上开了一个问题:https://github.com/marmelab/admin-on-rest/issues/1000
我指的是以下文档,
Tip: The props you pass to
<SimpleForm>
and<TabbedForm>
end up as reduxForm() parameters. This means that, in addition to validate, you can also pass warn or asyncValidate functions. Read the reduxForm() documentation for details.
https://marmelab.com/admin-on-rest/CreateEdit.html#validation
我尝试在字段级别和表单级别定义 warn
属性,但没有显示警告文本。但是,我确实看到 warning
属性 在该字段的 meta
属性 中设置正确。
这是一个错误还是我遗漏了什么?谢谢
示例(字段级别):
const isTest = val => (val === "TEST" ? "Really, TEST?" : undefined);
const PeersCreateEditInputs = (
<SimpleForm>
<TextInput source="ln" label="Name" validate={[required]} warn={isTest} />
....
示例(表单级别):
const isTest = values => {
const warnings = {};
if (values.ln === "TEST") {
warnings.ln = "Hmm, still TEST?";
}
return warnings;
};
const PeersCreateEditInputs = (
<SimpleForm warn={isTest}>
<TextInput source="ln" label="Name" validate={[required]} />
...
找到了,警告通过但不显示。我在 admin-on-rest
存储库上开了一个问题:https://github.com/marmelab/admin-on-rest/issues/1000