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
This function allows you to dynamically set multiple field values at once and have the options to validate and update the form state. It also accepts a callback function that receives the current form values, making it easy to derive the next state from the existing one.
|`value`<br/><TypeText>Partial\<TFieldValues\>\| (data: TFieldValues) => Partial\<TFieldValues\></TypeText> || An object containing the field values to update, or a callback function that receives the current form values and returns the updated values. This argument is required.|
19
-
|`options`|`shouldValidate`<br/><TypeText>boolean</TypeText> | <ul><li>Whether to compute if your input is valid or not (subscribed to <TypeText>errors</TypeText>).</li><li>Whether to compute if your entire form is valid or not (subscribed to <TypeText>isValid</TypeText>).</li></ul> |
20
-
||`shouldDirty`<br/><TypeText>boolean</TypeText> | <ul><li>Whether to compute if your input is dirty or not against your `defaultValues` (subscribed to <TypeText>dirtyFields</TypeText>).</li><li>Whether to compute if your entire form is dirty or not against your `defaultValues` (subscribed to <TypeText>isDirty</TypeText>).</li></ul> |
21
-
||`shouldTouch`<br/><TypeText>boolean</TypeText> | Whether to set the updated inputs to be touched. |
|`value`<br/><TypeText>Partial\<TFieldValues\>\| (formValues: TFieldValues) => TFieldValues</TypeText> || An object containing the field values to update, or a callback function that receives the current form values and returns the next form values. This argument is required. |
19
+
|`options`|`shouldValidate`<br/><TypeText>boolean</TypeText> | <ul><li>Whether to compute if your input is valid or not (subscribed to <TypeText>errors</TypeText>).</li><li>Whether to compute if your entire form is valid or not (subscribed to <TypeText>isValid</TypeText>).</li></ul> |
20
+
||`shouldDirty`<br/><TypeText>boolean</TypeText> | <ul><li>Whether to compute if your input is dirty or not against your `defaultValues` (subscribed to <TypeText>dirtyFields</TypeText>).</li><li>Whether to compute if your entire form is dirty or not against your `defaultValues` (subscribed to <TypeText>isDirty</TypeText>).</li></ul> |
21
+
||`shouldTouch`<br/><TypeText>boolean</TypeText> | Whether to set the updated inputs to be touched. |
22
22
23
23
<Admonitiontype="important"title="Rules">
24
24
25
-
- When using the callback form, the function receives a snapshot of the current form values and should return only the fields you want to update.
25
+
- When using the callback form, the function receives a snapshot of the current form values and should return the next form values.
26
26
27
27
- This method does not reset the form. Use [`reset`](/docs/useform/reset) if you need to reinitialize `defaultValues`.
0 commit comments