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

FieldApi.md

785 lines18.5 KB

1---
2id: FieldApi
3title: FieldApi
4---
5​
6# Class: FieldApi\<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta\>
7​
8Defined in: [packages/form-core/src/FieldApi.ts:520](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L520)
9​
10A class representing the API for managing a form field.
11​
12Normally, you will not need to create a new `FieldApi` instance directly.
13Instead, you will use a framework hook/function like `useField` or `createField`
14to create a new instance for you that uses your framework's reactivity model.
15However, if you need to create a new instance manually, you can do so by calling
16the `new FieldApi` constructor.
17​
18## Type Parameters
19​
20### TParentData
21​
22`TParentData`
23​
24### TName
25​
26`TName` *extends* [`DeepKeys`](../type-aliases/DeepKeys.md)\<`TParentData`\>
27​
28### TData
29​
30`TData` *extends* [`DeepValue`](../type-aliases/DeepValue.md)\<`TParentData`, `TName`\>
31​
32### TOnMount
33​
34`TOnMount` *extends* `undefined` \| `FieldValidateOrFn`\<`TParentData`, `TName`, `TData`\>
35​
36### TOnChange
37​
38`TOnChange` *extends* `undefined` \| `FieldValidateOrFn`\<`TParentData`, `TName`, `TData`\>
39​
40### TOnChangeAsync
41​
42`TOnChangeAsync` *extends* `undefined` \| `FieldAsyncValidateOrFn`\<`TParentData`, `TName`, `TData`\>
43​
44### TOnBlur
45​
46`TOnBlur` *extends* `undefined` \| `FieldValidateOrFn`\<`TParentData`, `TName`, `TData`\>
47​
48### TOnBlurAsync
49​
50`TOnBlurAsync` *extends* `undefined` \| `FieldAsyncValidateOrFn`\<`TParentData`, `TName`, `TData`\>
51​
52### TOnSubmit
53​
54`TOnSubmit` *extends* `undefined` \| `FieldValidateOrFn`\<`TParentData`, `TName`, `TData`\>
55​
56### TOnSubmitAsync
57​
58`TOnSubmitAsync` *extends* `undefined` \| `FieldAsyncValidateOrFn`\<`TParentData`, `TName`, `TData`\>
59​
60### TOnDynamic
61​
62`TOnDynamic` *extends* `undefined` \| `FieldValidateOrFn`\<`TParentData`, `TName`, `TData`\>
63​
64### TOnDynamicAsync
65​
66`TOnDynamicAsync` *extends* `undefined` \| `FieldAsyncValidateOrFn`\<`TParentData`, `TName`, `TData`\>
67​
68### TFormOnMount
69​
70`TFormOnMount` *extends* `undefined` \| `FormValidateOrFn`\<`TParentData`\>
71​
72### TFormOnChange
73​
74`TFormOnChange` *extends* `undefined` \| `FormValidateOrFn`\<`TParentData`\>
75​
76### TFormOnChangeAsync
77​
78`TFormOnChangeAsync` *extends* `undefined` \| `FormAsyncValidateOrFn`\<`TParentData`\>
79​
80### TFormOnBlur
81​
82`TFormOnBlur` *extends* `undefined` \| `FormValidateOrFn`\<`TParentData`\>
83​
84### TFormOnBlurAsync
85​
86`TFormOnBlurAsync` *extends* `undefined` \| `FormAsyncValidateOrFn`\<`TParentData`\>
87​
88### TFormOnSubmit
89​
90`TFormOnSubmit` *extends* `undefined` \| `FormValidateOrFn`\<`TParentData`\>
91​
92### TFormOnSubmitAsync
93​
94`TFormOnSubmitAsync` *extends* `undefined` \| `FormAsyncValidateOrFn`\<`TParentData`\>
95​
96### TFormOnDynamic
97​
98`TFormOnDynamic` *extends* `undefined` \| `FormValidateOrFn`\<`TParentData`\>
99​
100### TFormOnDynamicAsync
101​
102`TFormOnDynamicAsync` *extends* `undefined` \| `FormAsyncValidateOrFn`\<`TParentData`\>
103​
104### TFormOnServer
105​
106`TFormOnServer` *extends* `undefined` \| `FormAsyncValidateOrFn`\<`TParentData`\>
107​
108### TParentSubmitMeta
109​
110`TParentSubmitMeta`
111​
112## Constructors
113​
114### Constructor
115​
116```ts
117new FieldApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>(opts): FieldApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
118```
119​
120Defined in: [packages/form-core/src/FieldApi.ts:712](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L712)
121​
122Initializes a new `FieldApi` instance.
123​
124#### Parameters
125​
126##### opts
127​
128[`FieldApiOptions`](../interfaces/FieldApiOptions.md)\<`TParentData`, `TName`, `TData`, `TOnMount`, `TOnChange`, `TOnChangeAsync`, `TOnBlur`, `TOnBlurAsync`, `TOnSubmit`, `TOnSubmitAsync`, `TOnDynamic`, `TOnDynamicAsync`, `TFormOnMount`, `TFormOnChange`, `TFormOnChangeAsync`, `TFormOnBlur`, `TFormOnBlurAsync`, `TFormOnSubmit`, `TFormOnSubmitAsync`, `TFormOnDynamic`, `TFormOnDynamicAsync`, `TFormOnServer`, `TParentSubmitMeta`\>
129​
130#### Returns
131​
132`FieldApi`\<`TParentData`, `TName`, `TData`, `TOnMount`, `TOnChange`, `TOnChangeAsync`, `TOnBlur`, `TOnBlurAsync`, `TOnSubmit`, `TOnSubmitAsync`, `TOnDynamic`, `TOnDynamicAsync`, `TFormOnMount`, `TFormOnChange`, `TFormOnChangeAsync`, `TFormOnBlur`, `TFormOnBlurAsync`, `TFormOnSubmit`, `TFormOnSubmitAsync`, `TFormOnDynamic`, `TFormOnDynamicAsync`, `TFormOnServer`, `TParentSubmitMeta`\>
133​
134## Properties
135​
136### form
137​
138```ts
139form: FormApi<TParentData, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
140```
141​
142Defined in: [packages/form-core/src/FieldApi.ts:612](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L612)
143​
144A reference to the form API instance.
145​
146#### Implementation of
147​
148```ts
149FieldLikeAPI.form
150```
151​
152***
153​
154### name
155​
156```ts
157name: TName;
158```
159​
160Defined in: [packages/form-core/src/FieldApi.ts:640](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L640)
161​
162The field name.
163​
164#### Implementation of
165​
166```ts
167FieldLikeAPI.name
168```
169​
170***
171​
172### options
173​
174```ts
175options: FieldApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
176```
177​
178Defined in: [packages/form-core/src/FieldApi.ts:644](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L644)
179​
180The field options.
181​
182#### Implementation of
183​
184```ts
185FieldLikeAPI.options
186```
187​
188***
189​
190### store
191​
192```ts
193store: ReadonlyStore<FieldLikeState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>>;
194```
195​
196Defined in: [packages/form-core/src/FieldApi.ts:672](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L672)
197​
198The field state store.
199​
200#### Implementation of
201​
202```ts
203FieldLikeAPI.store
204```
205​
206***
207​
208### timeoutIds
209​
210```ts
211timeoutIds: object;
212```
213​
214Defined in: [packages/form-core/src/FieldApi.ts:703](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L703)
215​
216#### formListeners
217​
218```ts
219formListeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>;
220```
221​
222#### listeners
223​
224```ts
225listeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>;
226```
227​
228#### validations
229​
230```ts
231validations: Record<ValidationCause, ReturnType<typeof setTimeout> | null>;
232```
233​
234## Accessors
235​
236### state
237​
238#### Get Signature
239​
240```ts
241get state(): FieldLikeState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
242```
243​
244Defined in: [packages/form-core/src/FieldApi.ts:700](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L700)
245​
246The current field state.
247​
248##### Returns
249​
250`FieldLikeState`\<`TParentData`, `TName`, `TData`, `TOnMount`, `TOnChange`, `TOnChangeAsync`, `TOnBlur`, `TOnBlurAsync`, `TOnSubmit`, `TOnSubmitAsync`, `TOnDynamic`, `TOnDynamicAsync`, `TFormOnMount`, `TFormOnChange`, `TFormOnChangeAsync`, `TFormOnBlur`, `TFormOnBlurAsync`, `TFormOnSubmit`, `TFormOnSubmitAsync`, `TFormOnDynamic`, `TFormOnDynamicAsync`\>
251​
252## Methods
253​
254### clearValues()
255​
256```ts
257clearValues(options?): void;
258```
259​
260Defined in: [packages/form-core/src/FieldApi.ts:1214](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1214)
261​
262Clear all values from the array.
263​
264#### Parameters
265​
266##### options?
267​
268`UpdateMetaOptions`
269​
270#### Returns
271​
272`void`
273​
274***
275​
276### getInfo()
277​
278```ts
279getInfo(): FieldInfo<TParentData>;
280```
281​
282Defined in: [packages/form-core/src/FieldApi.ts:1100](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1100)
283​
284Gets the field information object.
285​
286#### Returns
287​
288`FieldInfo`\<`TParentData`\>
289​
290#### Implementation of
291​
292```ts
293FieldLikeAPI.getInfo
294```
295​
296***
297​
298### getMeta()
299​
300```ts
301getMeta(): FieldLikeMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
302```
303​
304Defined in: [packages/form-core/src/FieldApi.ts:1064](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1064)
305​
306#### Returns
307​
308`FieldLikeMeta`\<`TParentData`, `TName`, `TData`, `TOnMount`, `TOnChange`, `TOnChangeAsync`, `TOnBlur`, `TOnBlurAsync`, `TOnSubmit`, `TOnSubmitAsync`, `TOnDynamic`, `TOnDynamicAsync`, `TFormOnMount`, `TFormOnChange`, `TFormOnChangeAsync`, `TFormOnBlur`, `TFormOnBlurAsync`, `TFormOnSubmit`, `TFormOnSubmitAsync`, `TFormOnDynamic`, `TFormOnDynamicAsync`\>
309​
310#### Implementation of
311​
312```ts
313FieldLikeAPI.getMeta
314```
315​
316***
317​
318### ~~getValue()~~
319​
320```ts
321getValue(): TData;
322```
323​
324Defined in: [packages/form-core/src/FieldApi.ts:1041](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1041)
325​
326Gets the current field value.
327​
328#### Returns
329​
330`TData`
331​
332#### Deprecated
333​
334Use `field.state.value` instead.
335​
336***
337​
338### handleBlur()
339​
340```ts
341handleBlur(): void;
342```
343​
344Defined in: [packages/form-core/src/FieldApi.ts:1739](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1739)
345​
346Handles the blur event.
347​
348#### Returns
349​
350`void`
351​
352***
353​
354### handleChange()
355​
356```ts
357handleChange(updater): void;
358```
359​
360Defined in: [packages/form-core/src/FieldApi.ts:1732](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1732)
361​
362Handles the change event.
363​
364#### Parameters
365​
366##### updater
367​
368[`Updater`](../type-aliases/Updater.md)\<`TData`\>
369​
370#### Returns
371​
372`void`
373​
374***
375​
376### insertValue()
377​
378```ts
379insertValue(
380 index,
381 value,
382 options?): void;
383```
384​
385Defined in: [packages/form-core/src/FieldApi.ts:1123](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1123)
386​
387Inserts a value at the specified index, shifting the subsequent values to the right.
388​
389#### Parameters
390​
391##### index
392​
393`number`
394​
395##### value
396​
397`TData` *extends* `any`[] ? `TData`\<`TData`\>\[`number`\] : `never`
398​
399##### options?
400​
401`UpdateMetaOptions`
402​
403#### Returns
404​
405`void`
406​
407***
408​
409### mount()
410​
411```ts
412mount(): () => void;
413```
414​
415Defined in: [packages/form-core/src/FieldApi.ts:859](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L859)
416​
417Mounts the field instance to the form.
418​
419#### Returns
420​
421A function to unmount the field instance.
422​
423```ts
424(): void;
425```
426​
427##### Returns
428​
429`void`
430​
431#### Implementation of
432​
433```ts
434FieldLikeAPI.mount
435```
436​
437***
438​
439### moveValue()
440​
441```ts
442moveValue(
443 aIndex,
444 bIndex,
445 options?): void;
446```
447​
448Defined in: [packages/form-core/src/FieldApi.ts:1198](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1198)
449​
450Moves the value at the first specified index to the second specified index.
451​
452#### Parameters
453​
454##### aIndex
455​
456`number`
457​
458##### bIndex
459​
460`number`
461​
462##### options?
463​
464`UpdateMetaOptions`
465​
466#### Returns
467​
468`void`
469​
470***
471​
472### parseValueWithSchema()
473​
474```ts
475parseValueWithSchema(schema):
476 | StandardSchemaV1Issue[]
477 | undefined;
478```
479​
480Defined in: [packages/form-core/src/FieldApi.ts:1782](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1782)
481​
482Parses the field's value with the given schema and returns
483issues (if any). This method does NOT set any internal errors.
484​
485#### Parameters
486​
487##### schema
488​
489[`StandardSchemaV1`](../type-aliases/StandardSchemaV1.md)\<`TData`, `unknown`\>
490​
491The standard schema to parse this field's value with.
492​
493#### Returns
494​
495 \| [`StandardSchemaV1Issue`](../interfaces/StandardSchemaV1Issue.md)[]
496 \| `undefined`
497​
498***
499​
500### parseValueWithSchemaAsync()
501​
502```ts
503parseValueWithSchemaAsync(schema): Promise<
504 | StandardSchemaV1Issue[]
505| undefined>;
506```
507​
508Defined in: [packages/form-core/src/FieldApi.ts:1794](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1794)
509​
510Parses the field's value with the given schema and returns
511issues (if any). This method does NOT set any internal errors.
512​
513#### Parameters
514​
515##### schema
516​
517[`StandardSchemaV1`](../type-aliases/StandardSchemaV1.md)\<`TData`, `unknown`\>
518​
519The standard schema to parse this field's value with.
520​
521#### Returns
522​
523`Promise`\<
524 \| [`StandardSchemaV1Issue`](../interfaces/StandardSchemaV1Issue.md)[]
525 \| `undefined`\>
526​
527***
528​
529### pushValue()
530​
531```ts
532pushValue(value, options?): void;
533```
534​
535Defined in: [packages/form-core/src/FieldApi.ts:1105](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1105)
536​
537Pushes a new value to the field.
538​
539#### Parameters
540​
541##### value
542​
543`TData` *extends* `any`[] ? `TData`\<`TData`\>\[`number`\] : `never`
544​
545##### options?
546​
547`UpdateMetaOptions`
548​
549#### Returns
550​
551`void`
552​
553***
554​
555### removeValue()
556​
557```ts
558removeValue(index, options?): void;
559```
560​
561Defined in: [packages/form-core/src/FieldApi.ts:1163](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1163)
562​
563Removes a value at the specified index.
564​
565#### Parameters
566​
567##### index
568​
569`number`
570​
571##### options?
572​
573`UpdateMetaOptions`
574​
575#### Returns
576​
577`void`
578​
579***
580​
581### replaceValue()
582​
583```ts
584replaceValue(
585 index,
586 value,
587 options?): void;
588```
589​
590Defined in: [packages/form-core/src/FieldApi.ts:1143](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1143)
591​
592Replaces a value at the specified index.
593​
594#### Parameters
595​
596##### index
597​
598`number`
599​
600##### value
601​
602`TData` *extends* `any`[] ? `TData`\<`TData`\>\[`number`\] : `never`
603​
604##### options?
605​
606`UpdateMetaOptions`
607​
608#### Returns
609​
610`void`
611​
612***
613​
614### setErrorMap()
615​
616```ts
617setErrorMap(errorMap): void;
618```
619​
620Defined in: [packages/form-core/src/FieldApi.ts:1755](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1755)
621​
622Updates the field's errorMap
623​
624#### Parameters
625​
626##### errorMap
627​
628`ValidationErrorMap`\<[`UnwrapFieldValidateOrFn`](../type-aliases/UnwrapFieldValidateOrFn.md)\<`TName`, `TOnMount`, `TFormOnMount`\>, [`UnwrapFieldValidateOrFn`](../type-aliases/UnwrapFieldValidateOrFn.md)\<`TName`, `TOnChange`, `TFormOnChange`\>, [`UnwrapFieldAsyncValidateOrFn`](../type-aliases/UnwrapFieldAsyncValidateOrFn.md)\<`TName`, `TOnChangeAsync`, `TFormOnChangeAsync`\>, [`UnwrapFieldValidateOrFn`](../type-aliases/UnwrapFieldValidateOrFn.md)\<`TName`, `TOnBlur`, `TFormOnBlur`\>, [`UnwrapFieldAsyncValidateOrFn`](../type-aliases/UnwrapFieldAsyncValidateOrFn.md)\<`TName`, `TOnBlurAsync`, `TFormOnBlurAsync`\>, [`UnwrapFieldValidateOrFn`](../type-aliases/UnwrapFieldValidateOrFn.md)\<`TName`, `TOnSubmit`, `TFormOnSubmit`\>, [`UnwrapFieldAsyncValidateOrFn`](../type-aliases/UnwrapFieldAsyncValidateOrFn.md)\<`TName`, `TOnSubmitAsync`, `TFormOnSubmitAsync`\>, [`UnwrapFieldValidateOrFn`](../type-aliases/UnwrapFieldValidateOrFn.md)\<`TName`, `TOnDynamic`, `TFormOnDynamic`\>, [`UnwrapFieldAsyncValidateOrFn`](../type-aliases/UnwrapFieldAsyncValidateOrFn.md)\<`TName`, `TOnDynamicAsync`, `TFormOnDynamicAsync`\>\>
629​
630#### Returns
631​
632`void`
633​
634***
635​
636### setMeta()
637​
638```ts
639setMeta(updater): void;
640```
641​
642Defined in: [packages/form-core/src/FieldApi.ts:1069](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1069)
643​
644Sets the field metadata.
645​
646#### Parameters
647​
648##### updater
649​
650[`Updater`](../type-aliases/Updater.md)\<`FieldLikeMetaBase`\<`TParentData`, `TName`, `TData`, `TOnMount`, `TOnChange`, `TOnChangeAsync`, `TOnBlur`, `TOnBlurAsync`, `TOnSubmit`, `TOnSubmitAsync`, `TOnDynamic`, `TOnDynamicAsync`, `TFormOnMount`, `TFormOnChange`, `TFormOnChangeAsync`, `TFormOnBlur`, `TFormOnBlurAsync`, `TFormOnSubmit`, `TFormOnSubmitAsync`, `TFormOnDynamic`, `TFormOnDynamicAsync`\>\>
651​
652#### Returns
653​
654`void`
655​
656#### Implementation of
657​
658```ts
659FieldLikeAPI.setMeta
660```
661​
662***
663​
664### setValue()
665​
666```ts
667setValue(updater, options?): void;
668```
669​
670Defined in: [packages/form-core/src/FieldApi.ts:1048](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1048)
671​
672Sets the field value and run the `change` validator.
673​
674#### Parameters
675​
676##### updater
677​
678[`Updater`](../type-aliases/Updater.md)\<`TData`\>
679​
680##### options?
681​
682`UpdateMetaOptions`
683​
684#### Returns
685​
686`void`
687​
688#### Implementation of
689​
690```ts
691FieldLikeAPI.setValue
692```
693​
694***
695​
696### swapValues()
697​
698```ts
699swapValues(
700 aIndex,
701 bIndex,
702 options?): void;
703```
704​
705Defined in: [packages/form-core/src/FieldApi.ts:1178](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1178)
706​
707Swaps the values at the specified indices.
708​
709#### Parameters
710​
711##### aIndex
712​
713`number`
714​
715##### bIndex
716​
717`number`
718​
719##### options?
720​
721`UpdateMetaOptions`
722​
723#### Returns
724​
725`void`
726​
727***
728​
729### update()
730​
731```ts
732update(opts): void;
733```
734​
735Defined in: [packages/form-core/src/FieldApi.ts:990](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L990)
736​
737Updates the field instance with new options.
738​
739#### Parameters
740​
741##### opts
742​
743[`FieldApiOptions`](../interfaces/FieldApiOptions.md)\<`TParentData`, `TName`, `TData`, `TOnMount`, `TOnChange`, `TOnChangeAsync`, `TOnBlur`, `TOnBlurAsync`, `TOnSubmit`, `TOnSubmitAsync`, `TOnDynamic`, `TOnDynamicAsync`, `TFormOnMount`, `TFormOnChange`, `TFormOnChangeAsync`, `TFormOnBlur`, `TFormOnBlurAsync`, `TFormOnSubmit`, `TFormOnSubmitAsync`, `TFormOnDynamic`, `TFormOnDynamicAsync`, `TFormOnServer`, `TParentSubmitMeta`\>
744​
745#### Returns
746​
747`void`
748​
749***
750​
751### validate()
752​
753```ts
754validate(cause, opts?): unknown[] | Promise<unknown[]>;
755```
756​
757Defined in: [packages/form-core/src/FieldApi.ts:1615](https://github.com/TanStack/form/blob/main/packages/form-core/src/FieldApi.ts#L1615)
758​
759Validates the field value.
760​
761#### Parameters
762​
763##### cause
764​
765`ValidationCause`
766​
767##### opts?
768​
769###### skipFormValidation?
770​
771`boolean`
772​
773###### skipGroupValidation?
774​
775`boolean`
776​
777#### Returns
778​
779`unknown`[] \| `Promise`\<`unknown`[]\>
780​
781#### Implementation of
782​
783```ts
784FieldLikeAPI.validate
785```