I would like to reset particular field (element) of SimpleForm from react-admin v4
At the moment the form have 3 related field like:
When you select A the select B is enabling and when B the same if for the C. The happy flow works very well.
Currently I'm using the FormDataConsumer so fields are dependent.
The problem is when user decide change element A or B. Then the form is not reloading again and the source is still the same.
So for example:
User selected A, field_a = X, then selected B, field_b = Y, then selected C, field_c = Z
Then the A has been updated so the result is the following:
formData.field_a is still setDo you have any ideas how to set the data base on onChange action?
I tried to use the refs, react-hook-form and register.
Is it any way to reset one field or many fields form form?
The form based on Input Components and <SimpleForm> provided by React-admin
The useForm() / useFormContext() hooks return a method: resetField("fieldName")
https://react-hook-form.com/api/useform/resetfield
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With