# FormSubmitContext

# Interface: FormSubmitContext\<TFormData, TSchemaOutputs, TFormErrorTypes\>

Defined in: [FormApi/FormApi.public.ts:101](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L101)

Context passed to `onSubmit` after submission validation succeeds.

## Example

```ts
{
  // ...
  onSubmit: async ({ value, createValidationError }) => {
    const result = await saveUser(value)

    if (!result.ok) {
      return createValidationError(result.error)
    }
  },
}
```

## Type Parameters

### TFormData

`TFormData`

Library-managed. Do not specify explicitly.

### TSchemaOutputs

`TSchemaOutputs`

Library-managed. Do not specify explicitly.

### TFormErrorTypes

`TFormErrorTypes` *extends* [`FormErrorTypes`](FormErrorTypes.md)

Library-managed. Do not specify explicitly.

## Properties

### createValidationError

```ts
createValidationError: CreateValidationErrorFn<TFormData>;
```

Defined in: [FormApi/FormApi.public.ts:149](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L149)

Creates a validation error that can be returned from `onSubmit`.

Return the created error from `onSubmit` to add its form- and field-level
errors to validation state.

#### Example

```ts
{
  // ...
  onSubmit: async ({ value, createValidationError }) => {
    const result = await saveUser(value)

    if (result.status === 409) {
      return createValidationError({
        form: 'A user with this email already exists',
        fields: {},
      })
    }
  },
}
```

***

### formApi

```ts
formApi: FormApi<TFormData, TFormErrorTypes>;
```

Defined in: [FormApi/FormApi.public.ts:109](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L109)

The form API handling this submission.

***

### parseIssues

```ts
parseIssues: ParseSubmitIssuesFn<TFormData>;
```

Defined in: [FormApi/FormApi.public.ts:170](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L170)

Parses Standard Schema issues into an error returnable from `onSubmit`.

Issue paths are mapped to fields in the submitted value. Return the parsed
error from `onSubmit` to add those errors to validation state.

#### Example

```ts
{
  // ...
  onSubmit: async ({ value, parseIssues }) => {
    const result = zodSchema.safeParse(value)

    if (!result.success) {
      return parseIssues(result.error.issues)
    }
  },
}
```

***

### schemaOutputs

```ts
schemaOutputs: TSchemaOutputs;
```

Defined in: [FormApi/FormApi.public.ts:125](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L125)

The submit outputs produced by the form's schema validators, ordered by
validator index.

#### Example

```ts
{
  // ...
  onSubmit: async ({ schemaOutputs }) => {
    const validatedUser = schemaOutputs[0]
    await saveUser(validatedUser)
  },
}
```

***

### value

```ts
value: TFormData;
```

Defined in: [FormApi/FormApi.public.ts:107](https://github.com/TanStack/form/blob/main/packages/form-core/src/FormApi/FormApi.public.ts#L107)

The form values for this submission.
