Documentation
Framework
Version
API Reference

FormState

Interface: FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>

Defined in: packages/form-core/src/FormApi.ts:744

An object representing the current state of the form.

Extends

  • BaseFormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>.DerivedFormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>

Type Parameters

TFormData

TOnMount extends undefined | FormValidateOrFn<TFormData>

TOnChange extends undefined | FormValidateOrFn<TFormData>

TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnBlur extends undefined | FormValidateOrFn<TFormData>

TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnSubmit extends undefined | FormValidateOrFn<TFormData>

TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnDynamic extends undefined | FormValidateOrFn<TFormData>

TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>

TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>

Properties

_force_re_eval?

optional _force_re_eval: boolean;
optional _force_re_eval: boolean;

Defined in: packages/form-core/src/FormApi.ts:663

@private, used to force a re-evaluation of the form state when options change

Inherited from

BaseFormState._force_re_eval
BaseFormState._force_re_eval

canSubmit

canSubmit: boolean;
canSubmit: boolean;

Defined in: packages/form-core/src/FormApi.ts:737

A boolean indicating if the form can be submitted based on its current state.

Inherited from

DerivedFormState.canSubmit
DerivedFormState.canSubmit

errorMap

errorMap: ValidationErrorMap<UnwrapFormValidateOrFn<TOnMount>, UnwrapFormValidateOrFn<TOnChange>, UnwrapFormAsyncValidateOrFn<TOnChangeAsync>, UnwrapFormValidateOrFn<TOnBlur>, UnwrapFormAsyncValidateOrFn<TOnBlurAsync>, UnwrapFormValidateOrFn<TOnSubmit>, UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>, UnwrapFormValidateOrFn<TOnDynamic>, UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>, UnwrapFormAsyncValidateOrFn<TOnServer>>;
errorMap: ValidationErrorMap<UnwrapFormValidateOrFn<TOnMount>, UnwrapFormValidateOrFn<TOnChange>, UnwrapFormAsyncValidateOrFn<TOnChangeAsync>, UnwrapFormValidateOrFn<TOnBlur>, UnwrapFormAsyncValidateOrFn<TOnBlurAsync>, UnwrapFormValidateOrFn<TOnSubmit>, UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>, UnwrapFormValidateOrFn<TOnDynamic>, UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>, UnwrapFormAsyncValidateOrFn<TOnServer>>;

Defined in: packages/form-core/src/FormApi.ts:607

The error map for the form itself.

Inherited from

BaseFormState.errorMap
BaseFormState.errorMap

errors

errors: (
  | UnwrapFormValidateOrFn<TOnMount>
  | UnwrapFormValidateOrFn<TOnChange>
  | UnwrapFormAsyncValidateOrFn<TOnChangeAsync>
  | UnwrapFormValidateOrFn<TOnBlur>
  | UnwrapFormAsyncValidateOrFn<TOnBlurAsync>
  | UnwrapFormValidateOrFn<TOnSubmit>
  | UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>
  | UnwrapFormValidateOrFn<TOnDynamic>
  | UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>
  | UnwrapFormAsyncValidateOrFn<TOnServer>)[];
errors: (
  | UnwrapFormValidateOrFn<TOnMount>
  | UnwrapFormValidateOrFn<TOnChange>
  | UnwrapFormAsyncValidateOrFn<TOnChangeAsync>
  | UnwrapFormValidateOrFn<TOnBlur>
  | UnwrapFormAsyncValidateOrFn<TOnBlurAsync>
  | UnwrapFormValidateOrFn<TOnSubmit>
  | UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>
  | UnwrapFormValidateOrFn<TOnDynamic>
  | UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>
  | UnwrapFormAsyncValidateOrFn<TOnServer>)[];

Defined in: packages/form-core/src/FormApi.ts:690

The error array for the form itself.

Inherited from

DerivedFormState.errors
DerivedFormState.errors

fieldMeta

fieldMeta: Record<DeepKeys<TFormData>, AnyFieldMeta>;
fieldMeta: Record<DeepKeys<TFormData>, AnyFieldMeta>;

Defined in: packages/form-core/src/FormApi.ts:741

A record of field metadata for each field in the form.

Inherited from

DerivedFormState.fieldMeta
DerivedFormState.fieldMeta

fieldMetaBase

fieldMetaBase: Record<DeepKeys<TFormData>, AnyFieldMetaBase>;
fieldMetaBase: Record<DeepKeys<TFormData>, AnyFieldMetaBase>;

Defined in: packages/form-core/src/FormApi.ts:626

A record of field metadata for each field in the form, not including the derived properties, like errors and such

Inherited from

BaseFormState.fieldMetaBase
BaseFormState.fieldMetaBase

isBlurred

isBlurred: boolean;
isBlurred: boolean;

Defined in: packages/form-core/src/FormApi.ts:717

A boolean indicating if any of the form fields have been blurred.

Inherited from

DerivedFormState.isBlurred
DerivedFormState.isBlurred

isDefaultValue

isDefaultValue: boolean;
isDefaultValue: boolean;

Defined in: packages/form-core/src/FormApi.ts:729

A boolean indicating if all of the form's fields are the same as default values.

Inherited from

DerivedFormState.isDefaultValue
DerivedFormState.isDefaultValue

isDirty

isDirty: boolean;
isDirty: boolean;

Defined in: packages/form-core/src/FormApi.ts:721

A boolean indicating if any of the form's fields' values have been modified by the user. Evaluates true if the user have modified at least one of the fields. Opposite of isPristine.

Inherited from

DerivedFormState.isDirty
DerivedFormState.isDirty

isFieldsValid

isFieldsValid: boolean;
isFieldsValid: boolean;

Defined in: packages/form-core/src/FormApi.ts:709

A boolean indicating if all the form fields are valid. Evaluates true if there are no field errors.

Inherited from

DerivedFormState.isFieldsValid
DerivedFormState.isFieldsValid

isFieldsValidating

isFieldsValidating: boolean;
isFieldsValidating: boolean;

Defined in: packages/form-core/src/FormApi.ts:705

A boolean indicating if any of the form fields are currently validating.

Inherited from

DerivedFormState.isFieldsValidating
DerivedFormState.isFieldsValidating

isFormValid

isFormValid: boolean;
isFormValid: boolean;

Defined in: packages/form-core/src/FormApi.ts:686

A boolean indicating if the form is valid.

Inherited from

DerivedFormState.isFormValid
DerivedFormState.isFormValid

isFormValidating

isFormValidating: boolean;
isFormValidating: boolean;

Defined in: packages/form-core/src/FormApi.ts:682

A boolean indicating if the form is currently validating.

Inherited from

DerivedFormState.isFormValidating
DerivedFormState.isFormValidating

isPristine

isPristine: boolean;
isPristine: boolean;

Defined in: packages/form-core/src/FormApi.ts:725

A boolean indicating if none of the form's fields' values have been modified by the user. Evaluates true if the user have not modified any of the fields. Opposite of isDirty.

Inherited from

DerivedFormState.isPristine
DerivedFormState.isPristine

isSubmitSuccessful

isSubmitSuccessful: boolean;
isSubmitSuccessful: boolean;

Defined in: packages/form-core/src/FormApi.ts:659

A boolean indicating if the last submission was successful.

Inherited from

BaseFormState.isSubmitSuccessful
BaseFormState.isSubmitSuccessful

isSubmitted

isSubmitted: boolean;
isSubmitted: boolean;

Defined in: packages/form-core/src/FormApi.ts:647

A boolean indicating if the onSubmit function has completed successfully.

Goes back to false at each new submission attempt.

Note: you can use isSubmitting to check if the form is currently submitting.

Inherited from

BaseFormState.isSubmitted
BaseFormState.isSubmitted

isSubmitting

isSubmitting: boolean;
isSubmitting: boolean;

Defined in: packages/form-core/src/FormApi.ts:639

A boolean indicating if the form is currently in the process of being submitted after handleSubmit is called.

Goes back to false when submission completes for one of the following reasons:

  • the validation step returned errors.
  • the onSubmit function has completed.

Note: if you're running async operations in your onSubmit function make sure to await them to ensure isSubmitting is set to false only when the async operation completes.

This is useful for displaying loading indicators or disabling form inputs during submission.

Inherited from

BaseFormState.isSubmitting
BaseFormState.isSubmitting

isTouched

isTouched: boolean;
isTouched: boolean;

Defined in: packages/form-core/src/FormApi.ts:713

A boolean indicating if any of the form fields have been touched.

Inherited from

DerivedFormState.isTouched
DerivedFormState.isTouched

isValid

isValid: boolean;
isValid: boolean;

Defined in: packages/form-core/src/FormApi.ts:733

A boolean indicating if the form and all its fields are valid. Evaluates true if there are no errors.

Inherited from

DerivedFormState.isValid
DerivedFormState.isValid

isValidating

isValidating: boolean;
isValidating: boolean;

Defined in: packages/form-core/src/FormApi.ts:651

A boolean indicating if the form or any of its fields are currently validating.

Inherited from

BaseFormState.isValidating
BaseFormState.isValidating

submissionAttempts

submissionAttempts: number;
submissionAttempts: number;

Defined in: packages/form-core/src/FormApi.ts:655

A counter for tracking the number of submission attempts.

Inherited from

BaseFormState.submissionAttempts
BaseFormState.submissionAttempts

validationMetaMap

validationMetaMap: Record<"onMount" | "onChange" | "onBlur" | "onSubmit" | "onDynamic" | "onServer", undefined | ValidationMeta>;
validationMetaMap: Record<"onMount" | "onChange" | "onBlur" | "onSubmit" | "onDynamic" | "onServer", undefined | ValidationMeta>;

Defined in: packages/form-core/src/FormApi.ts:622

An internal mechanism used for keeping track of validation logic in a form.

Inherited from

BaseFormState.validationMetaMap
BaseFormState.validationMetaMap

values

values: TFormData;
values: TFormData;

Defined in: packages/form-core/src/FormApi.ts:603

The current values of the form fields.

Inherited from

BaseFormState.values
BaseFormState.values
Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.