Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

FormGroupSubmitContext.md

107 lines2.1 KB

Defined in: FormGroupApi/FormGroupApi.public.ts:26

Context passed to a form group's onSubmit after group validation succeeds.

Example

{
  // ...
  onSubmit: async ({ value }) => {
    await saveGuestDetails(value)
  },
}

Type Parameters

TFormData

TFormData

TGroupName

TGroupName

TGroupValue

TGroupValue

TOutputs

TOutputs

TGroupErrorTypes

TGroupErrorTypes extends FormErrorTypes

TFormErrorTypes

TFormErrorTypes extends FormErrorTypes

Properties

formApi

formApi: FormApi<TFormData, TFormErrorTypes>;

Defined in: FormGroupApi/FormGroupApi.public.ts:37

The parent form API handling this submission.


groupApi

groupApi: FormGroupApi<TFormData, TGroupName, TGroupValue, TGroupErrorTypes, TFormErrorTypes>;

Defined in: FormGroupApi/FormGroupApi.public.ts:39

The group API handling this submission.


validatorOutputs

validatorOutputs: TOutputs;

Defined in: FormGroupApi/FormGroupApi.public.ts:62

Schema outputs and createOutput payloads from this group submission, ordered by validator index. Skipped validators and successful returns without an output contribute undefined.

Example

{
  // ...
  onSubmit: async ({ validatorOutputs }) => {
    const validatedGuestDetails = validatorOutputs[0]
    setStep(step => step + 1)
  },
}

value

value: TGroupValue;

Defined in: FormGroupApi/FormGroupApi.public.ts:35

The group values for this submission.