You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
We need to be able to exclude fields from the options of useControlled.
Describe the Feature
In a complex form with lots of subcomponents the place where you load the form values from the backend and set the default values on the form is in a different component than the fields.
The component where I do useForm({ defaultValues: { someSelect: 'foo' } }) has no idea how "someSelect" will be displayed (as a select / radios / input / etc).
In my case "someSelect" will be rendered with react-select meaning that I have a custom component using useControlled to wrap react-select. And it's in this custom wrapper where I need to tell the RCF to ignore the field.
There are 2 more reasons to consider implementing this change:
if I ever change react-select to something else which doesn't require excluding anything I will have to change 2 components: the select wrapper component and the one with the useForm to remove the exclusion.
in a highly dynamic form where users can add new fields (useFieldArray for example) it's very dirty (not DRY) to add logic to the component with useForm to exclude these dynamically added inputs.
The text was updated successfully, but these errors were encountered:
Feature Request
We need to be able to exclude fields from the options of
useControlled
.Describe the Feature
In a complex form with lots of subcomponents the place where you load the form values from the backend and set the default values on the form is in a different component than the fields.
The component where I do
useForm({ defaultValues: { someSelect: 'foo' } })
has no idea how "someSelect" will be displayed (as a select / radios / input / etc).In my case "someSelect" will be rendered with
react-select
meaning that I have a custom component usinguseControlled
to wrapreact-select
. And it's in this custom wrapper where I need to tell the RCF to ignore the field.There are 2 more reasons to consider implementing this change:
react-select
to something else which doesn't require excluding anything I will have to change 2 components: the select wrapper component and the one with the useForm to remove the exclusion.useFieldArray
for example) it's very dirty (not DRY) to add logic to the component with useForm to exclude these dynamically added inputs.The text was updated successfully, but these errors were encountered: