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
Copy file name to clipboardExpand all lines: articles/FormState.md
-38Lines changed: 0 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,58 +10,40 @@ This class provides a lot of useful functions to manipulate form values and stat
10
10
11
11
The values of the form. Can be set with `setValues()`.
12
12
13
-
---
14
-
15
13
#### `defaultValues`**(readonly)**
16
14
17
15
The default values of the form. Input elements do not change this. This gets used to reset the form and to calculate dirty flags. Can be set with `setDefaultValues()`.
18
16
19
-
---
20
-
21
17
#### `childMap`**(readonly)**
22
18
23
19
Each child form bound registers itself in this object. It maps field names to `ChildFormState` instances.
24
20
25
-
---
26
-
27
21
#### `dirtyMap`**(readonly)**
28
22
29
23
Maps field names to dirty values. A field is dirty when its value is not equal anymore to its default value.
30
24
31
-
---
32
-
33
25
#### `errorMap`**(readonly)**
34
26
35
27
Maps field names to errors. Can be set with `setErrors()`.
36
28
37
-
---
38
-
39
29
#### `state`**(readonly)**
40
30
41
31
Gets the current form state. Form state contains variables like `isSubmitting` etc. This state is synced with parent and child forms. Can be set with [`setState()`](/docs/FormState#setstatenewstate).
42
32
43
33
See [`useForm`](/docs/useForm) for a guide on how to create custom form state.
44
34
45
-
---
46
-
47
35
#### `dirty`**(readonly)**
48
36
49
37
Has any field in this form been modified?
50
38
51
-
---
52
-
53
39
#### `error`**(readonly)**
54
40
55
41
Is there any error in this form?
56
42
57
-
---
58
-
59
43
#### `validateOnChange`
60
44
61
45
Validate on value change?
62
46
63
-
---
64
-
65
47
#### `validator`
66
48
67
49
The form's validator.
@@ -77,8 +59,6 @@ Sets a field value or default value.
77
59
-`validate`**(optional)**: Validate? When defined, overrides `validateOnChange`.
78
60
-`isDefault`**(optional, false)**: When true, updates the default value instead of the normal value.
@@ -87,62 +67,46 @@ Sets values _OR_ default values for a form.
87
67
-`validate`**(optional)**: Validate? When defined, overrides `validateOnChange`.
88
68
-`isDefault`**(optional, false)**: When true, updates the default values instead of the normal values. Only updates one or the other, to set both at the same time, use `setDefaultValues()` or 2 function calls.
-`errors`**(required)**: The new errors for this form. Use {} to clear errors. **The format of this error object must follow the same structure of the values object, but each value is replaced by its error.**
A lot of functions have the parameters `notifyChild/notifyParent`, these parameters tells the form if the action that was just done has to notify parent or child forms. **Parent and child forms are always notified by default**
@@ -157,8 +121,6 @@ ChildFormState inherits from FormState, and provides these additional properties
157
121
158
122
The parent form of this form. Which is a `FormState` or `ChildFormState` instance.
159
123
160
-
---
161
-
162
124
#### `name`
163
125
164
126
The name of this form, which is the name of the field in the parent form which this child form represents.
Copy file name to clipboardExpand all lines: articles/Getting-started.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ This library provides the following built-in components to create type-checked i
65
65
-[FormSelect](/docs/FormSelect)
66
66
-[FormTextArea](/docs/FormTextArea)
67
67
68
-
When these inputs do not satisfy your needs, you can always [implement your own](/docs/Custom-inputs#example-custom-input). These built-in components are just abstractions around hook calls.
68
+
When these inputs do not satisfy your needs, you can always [implement your own](/docs/Custom-input#example-custom-input). These built-in components are just abstractions around hook calls.
69
69
70
70
✔️ **Example type-checked form consisting of 2 fields**
0 commit comments