gpt4 book ai didi

admin-on-rest - redux 表单字段警告是否在 Admin 中对剩余输入有效?

转载 作者:行者123 更新时间:2023-12-04 06:01:15 25 4
gpt4 key购买 nike

我指的是下面的文档,

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字段级别和表单级别的属性,但不会显示警告文本。但是,我确实看到了 warningmeta 中正确设置了属性该字段的属性。

这是一个错误还是我遗漏了什么?谢谢

示例(字段级别):

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

关于admin-on-rest - redux 表单字段警告是否在 Admin 中对剩余输入有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46036622/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com