Recommended Types
Form Composition API Reference
FormApi Reference
- form.setFieldValue()
- form.getFieldValue()
- form.resetField()
- form.swapFieldValues()
- form.moveFieldValue()
- form.pushFieldValue()
- form.insertFieldValue()
- form.clearFieldValues()
- form.removeFieldValue()
- form.filterFieldValues()
- form.handleSubmit()
- form.reset()
- FormApi
- FormOptions
- FormState
- FormResetOptions
- FormSubmitContext
- FormSubmitInvalidContext
Form Listener API Reference
Field Listener API Reference
FormSubmitInvalidContext
Defined in: FormApi/formSubmit.public.ts:337
Gives onSubmitInvalid the submitted values, form instance, and details of a validation failure or exception.
Remarks#
Important: Handling an exception in onSubmitInvalid does not prevent handleSubmit() from rejecting. Call preventThrow() during the callback to suppress the submission's exception.
Extends#
Type Parameters#
TFormData#
TFormData
Library-managed. Do not specify explicitly.
TFormError#
TFormError extends ScopedErrorTypes
Library-managed. Do not specify explicitly.
Properties#
error#
error: unknown;Defined in: FormApi/formSubmit.public.ts:308
The exception from validation or onSubmit. Always undefined when reason is validation.
An exception can also be undefined; check reason to distinguish the cases.
Inherited from#
formApi#
formApi: FormApi<TFormData, TFormError>;Defined in: FormApi/formSubmit.public.ts:352
The form whose submission failed. Use formApi.state to inspect current values and validation state, including edits made since submission started.
preventThrow#
preventThrow: () => void;Defined in: FormApi/formSubmit.public.ts:322
Prevents this submission's exception from rejecting handleSubmit().
Call during onSubmitInvalid, before it returns or its returned promise settles. Has no effect when reason is validation.
The submission remains unsuccessful. handleSubmit() resolves with any collected validation errors, or an empty array.
Returns#
void
Remarks#
Important: This does not suppress exceptions thrown or rejected by onSubmitInvalid itself.
Inherited from#
SubmitInvalidContext.preventThrow
reason#
reason: "exception" | "validation";Defined in: FormApi/formSubmit.public.ts:295
How submission failed:
- validation for reported validation errors
- exception for a thrown value or rejected promise
Inherited from#
signal#
signal: AbortSignal;Defined in: FormApi/formSubmit.public.ts:289
The same signal passed to this attempt's onSubmit, if it ran.
Aborted when the attempt is superseded or invalidated by reset, unmount, or server-state replacement. A running callback is still awaited. An aborted signal does not change reason or automatically suppress exceptions.
Inherited from#
source#
source: "onSubmit" | "validators";Defined in: FormApi/formSubmit.public.ts:301
Where submission failed:
- validators failed during field and form or form-group validation
- onSubmit failed during the onSubmit handler
Inherited from#
value#
value: TFormData;Defined in: FormApi/formSubmit.public.ts:347
The form values captured when this submission started, without schema transformations applied.
Field edits made while submission is pending do not replace these values.