在ReactAdmin V4中动态更改FormData
我们有一个相当复杂的创建形式,该形式的输入字段由此形式的其他输入字段计算出来。
我们使用FormDataConsumer
读取当前表单数据,但是,如果我们更改给定的formdata
或scopedformData
计算的输入保持不变。 我们还尝试使用useWatch
或观看
来自已经使用的react-hook-form
lib,但是当用户制作时,未调用回调输入。
我们还尝试了React Admin USEINPUT
,但不知道如何传递自定义onChange
事件。在 on Change 描述的方法。
当其他输入字段更改时,我们如何更改此输入字段值(promopartner
,locale
和enddateEnabled
)?计算的字段也必须在表格提交中发送。
这是代码盒样本
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论