You can use the dependencies
prop of Form.Item
to specify which fields/props the item depends on. This will ensure that form.setFieldsValue
is triggered when any of the dependencies change.
For example, if you have a Form.Item
with multiple elements such as Input
and Checkbox
, you can set the dependencies
prop to an array containing the field names of both elements:
<Form.Item
label="My Field"
dependencies={['myInput', 'myCheckbox']}
>
<Input name="myInput" />
<Checkbox name="myCheckbox">Check me</Checkbox>
</Form.Item>
Now, when you call form.setFieldsValue
to update the value of either myInput
or myCheckbox
, the Form.Item
will be re-rendered and the updated value will be displayed.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-28 21:59:09 +0000
Seen: 9 times
Last updated: May 28 '23
What is the process to detect and count common elements in R?
How can you space out HTML elements using CSS exclusively?
Can an Array of Elements be made in Android?
What is the method to show a line break <br> between <div> elements in Laravel?
When does the ForEach loop come to an end? Does it happen when a null value is returned?
What is the method to attain this arrangement of elements?
How can one go over a key/value map object by repeatedly executing its elements?