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: advanced/context.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ description: FormKit provides a reactive context object to expose data to slots,
5
5
6
6
# Context object
7
7
8
-
FormKit inputs use a reactive object to expose data to slots, rules, and the underlying [schema](/advanced/schema) that defines the input. This is called the `context` object and is found in the each input's [core `node` object](/advanced/core-node) at `node.context`. The context object has the following properties:
8
+
FormKit inputs use a reactive object to expose data to slots, rules, and the underlying [schema](/advanced/schema) that defines the input. This is called the `context` object and is found in the each input's [core `node` object](/advanced/core#node) at `node.context`. The context object has the following properties:
Copy file name to clipboardExpand all lines: essentials/forms.md
+15-7Lines changed: 15 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,19 @@ description: Collect all of your FormKit data, submit to your server, and handle
5
5
6
6
# Forms
7
7
8
-
While you’re free to use `FormKit` inputs by themselves, you’ll usually want to group them into a form. To do this, you simply wrap your inputs in a `<FormKit type="form">`.
8
+
While you’re free to use `FormKit` inputs by themselves, you’ll usually want to group them into a form. To do this, simply wrap your inputs in a `<FormKit type="form">`.
9
9
10
-
The `form` type will actively collect all the values from child inputs, using the name of each input as the property name in the resulting data object (just like [groups](/inputs/group)). You can also read and write to form values using v-model just as you would on any input.
10
+
The `form` type will actively collect all the values from child inputs, using the `name` of each input as the property name in the resulting data object (just like [groups](/inputs/group)). You can also read and write to form values using v-model just as you would on any input.
11
11
12
-
A `<FormKit type="form">` tracks the validation state of the form and prevents users from submitting the form if any inputs are invalid. As a convenience, the `form` also outputs a submit button (which you can disable with the `actions="false"` prop).
12
+
A `<FormKit type="form">` tracks the form's validation state and prevents users from submitting the form if any inputs are invalid.
13
+
14
+
### Provided submit button
15
+
16
+
As a convenience, the `form` outputs a submit button automatically, and provided themes also include a loading spinner. You can alter this button with the `submit-label` and `submit-attrs` props, or disable with `:actions="false"`.
17
+
18
+
### Full example form
19
+
20
+
Excluding backend functionality, here is a fully featured form with inputs (`form`, `text`, `email`, `password`), help text, labels, validation with custom messages, and error and submission handling:
13
21
14
22
<example
15
23
name="Register example"
@@ -35,7 +43,7 @@ Using <code>v-model</code> data in your submit handler could lead to unintended
35
43
36
44
Forms are usually submitted through user actions like clicking a submit button or hitting the `enter` key on a text node within the form. Upon submission, the form (in sequence):
37
45
38
-
1.It ensures all inputs are settled (finished debouncing).
46
+
1.Ensures all inputs are settled (finished debouncing).
39
47
1. Emits the `@submit-raw` event.
40
48
1. Sets the `submitted` state to true on all inputs — displaying any remaining validation errors (regardless of the `validation-visibility`).
41
49
1. If all inputs are valid it fires the `@submit` event.
@@ -46,8 +54,8 @@ Forms are usually submitted through user actions like clicking a submit button o
46
54
The most common method of form submission in a modern SPA is an XHR request (think [axios](https://axios-http.com/) or [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)). FormKit is well suited to this task:
47
55
48
56
- It hands your submit handler a request-ready object.
49
-
- If you return a promise from your submit handler it will apply a loading state to your form (`loading` becomes true at `context.state.loading`).
50
-
- It handles backend errors by placing error messages directly on the failing inputs**(NOTE: not yet implemented in FormKit Alpha)**.
57
+
- If you return a promise from your submit handler, it will apply a loading state to your form (`loading` becomes true at `context.state.loading`). A loading spinner is added in provided themes.
58
+
- It handles [backend errors](#error-handling) by placing error messages directly on the failing inputs.
51
59
52
60
<example
53
61
name="Text example"
@@ -182,7 +190,7 @@ When inputs are unmounted from a form — for example when using `v-if` — the
182
190
183
191
Forms are technically considered `input` types — so they share many of the universal props that standard inputs use.
184
192
185
-
<reference-table:without="['label', 'help']":data="[{ prop: 'disabled', type: 'Boolean', default: 'false', description: 'Disables the form submit button and all the inputs in the form.'}, { prop: 'incomplete-message', type: 'String/Boolean', default: '{locale}.ui.incomplete', description: 'The message that is shown to near the submit button when a user attempts to submit a form, but not all inputs are valid.'}, { prop: 'submit-attrs', type: 'Object', default: '{}', description: 'Attributes or props that should be passed to the submit button.'}, { prop: 'submit-label', type: 'String', default: 'Submit', description: 'The label to use on the submit button.'}, { prop: 'actions', type: 'Boolean', default: 'true', description: 'Whether or not to include the actions bar at the bottom of the form (ex. you want to remove the submit button and use your own, set this to <code>false</code>).'}]"></reference-table>
193
+
<reference-table:without="['label', 'help']":data="[{ prop: 'disabled', type: 'Boolean', default: 'false', description: 'Disables the form submit button and all the inputs in the form.'}, { prop: 'incomplete-message', type: 'String/Boolean', default: '{locale}.ui.incomplete', description: 'The message that is shown to near the submit button when a user attempts to submit a form, but not all inputs are valid.'}, { prop: 'submit-attrs', type: 'Object', default: '{}', description: 'Attributes or props that should be passed to the built-in submit button.'}, { prop: 'submit-label', type: 'String', default: 'Submit', description: 'The label to use on the built-in submit button.'}, { prop: 'actions', type: 'Boolean', default: 'true', description: 'Whether or not to include the actions bar at the bottom of the form (ex. you want to remove the submit button and use your own, set this to <code>false</code>).'}]"></reference-table>
Copy file name to clipboardExpand all lines: essentials/inputs.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,7 @@ For performance, all FormKit inputs support debouncing as a first-class feature.
104
104
105
105
Internally, FormKit debounces the `input` event. When the debounce has "settled", the new value is “committed” and the rest of the application is then notified via the [input node’s `commit` event](/advanced/core#events). The default debounce delay is 20 milliseconds and can be adjusted with the `delay` prop or config option.
106
106
107
-
To illustrate this, lets`v-model` a `group` input and observe how its value is not updated until after our egregiously long `delay`:
107
+
To illustrate this, let's`v-model` a `group` input and observe how its value is not updated until after our egregiously long `delay`:
Copy file name to clipboardExpand all lines: essentials/internationalization.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -79,5 +79,5 @@ Writing a locale for your own native language is a great way to contribute to Fo
79
79
Of course, you are not required to use our locale builder to submit a language, and are more than welcome to submit a standard pull request with your locale included.
80
80
81
81
<callouttype="info"label="Localization">
82
-
If your language is already on the list (lets say English), but your locality speaks a variation of that language (like 🇬🇧 <code>en-GB</code>), please feel free to submit your localized language.
82
+
If your language is already on the list (let's say English), but your locality speaks a variation of that language (like 🇬🇧 <code>en-GB</code>), please feel free to submit your localized language.
0 commit comments