Skip to content

Commit 2b47c9a

Browse files
[10.x] Document form.processing (#8834)
* Add processing docs * Update precognition.md * Update precognition.md --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 9838f34 commit 2b47c9a

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

precognition.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ const submit = () => form.submit();
8383
{{ form.errors.email }}
8484
</div>
8585
86-
<button>Create User</button>
86+
<button :disabled="form.processing">
87+
Create User
88+
</button>
8789
</form>
8890
</template>
8991
```
@@ -161,6 +163,14 @@ const submit = () => form.submit()
161163
});
162164
```
163165

166+
You may determine if a form submission request is in-flight by inspecting the form's `processing` property:
167+
168+
```html
169+
<button :disabled="form.processing">
170+
Submit
171+
</button>
172+
```
173+
164174
<a name="using-vue-and-inertia"></a>
165175
### Using Vue & Inertia
166176

@@ -254,7 +264,9 @@ export default function Form() {
254264
/>
255265
{form.invalid('email') && <div>{form.errors.email}</div>}
256266

257-
<button>Create User</button>
267+
<button disabled={form.processing}>
268+
Create User
269+
</button>
258270
</form>
259271
);
260272
};
@@ -327,6 +339,14 @@ const submit = (e) => {
327339
};
328340
```
329341

342+
You may determine if a form submission request is in-flight by inspecting the form's `processing` property:
343+
344+
```html
345+
<button disabled={form.processing}>
346+
Submit
347+
</button>
348+
```
349+
330350
<a name="using-react-and-inertia"></a>
331351
### Using React & Inertia
332352

@@ -429,7 +449,9 @@ To enable live validation, you should bind the form's data to it's relevant inpu
429449
<div x-text="form.errors.email"></div>
430450
</template>
431451

432-
<button>Create User</button>
452+
<button :disabled="form.processing">
453+
Create User
454+
</button>
433455
</form>
434456
```
435457

@@ -478,6 +500,14 @@ You may also determine if an input has passed or failed validation by passing th
478500
> **Warning**
479501
> A form input will only appear as valid or invalid once it has changed and a validation response has been received.
480502
503+
You may determine if a form submission request is in-flight by inspecting the form's `processing` property:
504+
505+
```html
506+
<button :disabled="form.processing">
507+
Submit
508+
</button>
509+
```
510+
481511
<a name="repopulating-old-form-data"></a>
482512
#### Repopulating Old Form Data
483513

0 commit comments

Comments
 (0)