在ReactAdmin V4中动态更改FormData

发布于 2025-02-12 01:56:25 字数 781 浏览 1 评论 0原文

我们有一个相当复杂的创建形式,该形式的输入字段由此形式的其他输入字段计算出来。

我们使用FormDataConsumer读取当前表单数据,但是,如果我们更改给定的formdatascopedformData计算的输入保持不变。 我们还尝试使用useWatch观看来自已经使用的react-hook-form lib,但是当用户制作时,未调用回调输入。

我们还尝试了React Admin USEINPUT,但不知道如何传递自定义onChange事件。在 on Change 描述的方法。

当其他输入字段更改时,我们如何更改此输入字段值(promopartnerlocaleenddateEnabled)?计算的字段也必须在表格提交中发送。

这是代码盒样本

We have a rather complex Create form which has an input field that is calculated by other input fields in this form.

We use FormDataConsumer to read the current form data, however if we change the given formData or scopedFormData the calculated input remains unchanged.
We also tried to use useWatch or watch from the already used react-hook-form lib but the callback isn't called when the user makes inputs.

We also tried the React Admin useInput but don't know how to pass a custom onChange event. In the docs is only the passing of the already applied onChange method described.

How can we change this input fields value, when other input fields change (promoPartner, locale and endDateEnabled)? The calculated field has to be sent within the form submit too.

Here is the codebox sample

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文