Skip to content

Commit f98461e

Browse files
committed
update get values api
1 parent c1d7ad3 commit f98461e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

next-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
/// <reference path="./.next/types/routes.d.ts" />
43

54
// NOTE: This file should not be edited
65
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.

src/content/docs/useform/getvalues.mdx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ An optimized helper for reading form values. The difference between `watch` and
1212

1313
---
1414

15-
| Type | Description |
16-
| ----------- | --------------------------------------------------------- |
17-
| `undefined` | Returns the entire form values. |
18-
| `string` | Gets the value at path of the form values. |
19-
| `array` | Returns an array of the value at path of the form values. |
15+
| Name | Type | Description |
16+
| ------------ | --------------- | --------------------------------------------------------- |
17+
| `fieldNames` | `undefined` | Returns the entire form values. |
18+
| | `string` | Gets the value at path of the form values. |
19+
| | `array` | Returns an array of the value at path of the form values. |
20+
| `config` | `dirtyFields` | Returns only dirty fields |
21+
| | `touchedFields` | Return only touchedFields |
2022

2123
**Examples:**
2224

@@ -30,12 +32,14 @@ The example below shows what to expect when you invoke `getValues` method.
3032
<input {...register("root.test2")} />
3133
```
3234

33-
| Name | Output |
34-
| ------------------------------------- | ----------------------------------- |
35-
| `getValues()` | `{ root: { test1: '', test2: ''} }` |
36-
| `getValues("root")` | `{ test1: '', test2: ''}` |
37-
| `getValues("root.firstName")` | `''` |
38-
| `getValues(["yourDetails.lastName"])` | `['']` |
35+
| Name | Output |
36+
| ----------------------------------------------- | ----------------------------------- |
37+
| `getValues()` | `{ root: { test1: '', test2: ''} }` |
38+
| `getValues("root")` | `{ test1: '', test2: ''}` |
39+
| `getValues("root.firstName")` | `''` |
40+
| `getValues(["yourDetails.lastName"])` | `['']` |
41+
| `getValues(undefined, { dirtyFields: true })` | `{ root: { test1: '', test2: ''} }` |
42+
| `getValues(undefined, { touchedFields: true })` | `{ root: { test1: '', test2: ''} }` |
3943

4044
<Admonition type="important" title="Rules">
4145

0 commit comments

Comments
 (0)