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

FormGroupValidatorContext.md

142 lines3.2 KB

1---
2id: FormGroupValidatorContext
3title: FormGroupValidatorContext
4---
5​
6Defined in: [validation.public.ts:867](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L867)
7​
8Values and helpers passed to a form group validation function.
9​
10## Type Parameters
11​
12### TGroupValue
13​
14`TGroupValue`
15​
16Library-managed. Do not specify explicitly.
17​
18## Properties
19​
20### createErrorMap
21​
22```ts
23createErrorMap: (initial?) => ValidationErrorMap<TGroupValue>;
24```
25​
26Defined in: [validation.public.ts:883](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L883)
27​
28Creates an error map whose field paths are relative to this group.
29​
30Creates a mutable map of form errors and errors for individual field paths.
31​
32Pass the completed map back from a form or group validator to report the errors.
33​
34#### Parameters
35​
36##### initial?
37​
38`Partial`\<[`ValidationErrorMap`](ValidationErrorMap.md)\<`TGroupValue`\>\>
39​
40An existing map to reuse. A missing `fields` object is added to it.
41​
42#### Returns
43​
44[`ValidationErrorMap`](ValidationErrorMap.md)\<`TGroupValue`\>
45​
46The initial map, if supplied, or a new map with an empty `fields` object.
47​
48***
49​
50### createOutput
51​
52```ts
53createOutput: CreateOutputFn;
54```
55​
56Defined in: [validation.public.ts:885](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L885)
57​
58Creates a successful result to return data in this validator's `validatorOutputs` entry.
59​
60***
61​
62### event
63​
64```ts
65event: ValidationTrigger;
66```
67​
68Defined in: [validation.public.ts:869](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L869)
69​
70The event that caused this validation run.
71​
72***
73​
74### formApi
75​
76```ts
77formApi: FormApi<any, any>;
78```
79​
80Defined in: [validation.public.ts:873](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L873)
81​
82The owning form, including values outside this group.
83​
84***
85​
86### groupApi
87​
88```ts
89groupApi: FormGroupApi<any, any, TGroupValue, any, any>;
90```
91​
92Defined in: [validation.public.ts:875](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L875)
93​
94The group whose value is being validated.
95​
96***
97​
98### parseIssues
99​
100```ts
101parseIssues: ParseFormIssuesFn<TGroupValue>;
102```
103​
104Defined in: [validation.public.ts:881](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L881)
105​
106Converts Standard Schema issues into group errors and errors at group-relative field paths.
107​
108***
109​
110### signal
111​
112```ts
113signal: AbortSignal;
114```
115​
116Defined in: [validation.public.ts:871](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L871)
117​
118Aborted when this run is cancelled. Pass it to asynchronous work such as `fetch`.
119​
120***
121​
122### triggerFieldApi?
123​
124```ts
125optional triggerFieldApi?: AnyFieldApi;
126```
127​
128Defined in: [validation.public.ts:877](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L877)
129​
130The field that caused validation, when available.
131​
132***
133​
134### value
135​
136```ts
137value: TGroupValue;
138```
139​
140Defined in: [validation.public.ts:879](https://github.com/TanStack/form/blob/main/packages/form-core/src/validation.public.ts#L879)
141​
142The group's current value, without the surrounding form values.