Class Form

Represents a form state. A form is essentially an InputGroup that validates over its member inputs before performing a form-specific action.

see

InputGroup Input Group

Type parameters

Type parameter Description
TInputs: InputGroupContent

content of an input group. This is typically inferred at instantiation time from the constructor.

TActionResult
TActionProgress

constructor

  • Parameters

    Returns Form

devOptions

devOptions: StateDevOptions

Development-time settings

options

options: FormOptions<TInputs, TActionResult, TActionProgress>

Form-specific options

flattedInputs

  • get flattedInputs(): Input<any>[]
  • Returns a flattened array of inputs. The order of inputs is not guaranteed.

    Use structure to get the input structure as specified in the constructor including the subgroups, or inputs without the subgroups.

    see

    structure

    see

    inputs

    Returns Input<any>[]

flattenedStructure

  • Returns an array of the input group's structural items. Unlike [[flattenedInputs]], the subgroups are not broken down into inputs here.

    Returns (Input<any> | InputGroup<any>)[]

inputErrors

  • get inputErrors(): Input<any>[]
  • Returns the validators of inputs specified at instantiation time that are currently in invalid state (doesn't have to be conclusively invalid).

    Returns Input<any>[]

inputValue

  • get inputValue(): InferInputGroupValue<TInputs>
  • Same as with value but each value is the current input value, not the confirmed input value.

    see

    value

    Returns InferInputGroupValue<TInputs>

inputs

  • get inputs(): InferInputGroupShape<TInputs>
  • Reflects the structure of inputs as provided in the constructor. If a function was passed in the constructor, it is evaluated here. Subgroups in the structures are collapsed into their structures.

    Use structure if you need the subgroups preserved. Use [[flattenedInputs]] if you don't care about the structure and just want the inputs in an array.

    see

    structure

    see

    [[flattenedInputs]]

    Returns InferInputGroupShape<TInputs>

inputsPendingValidation

  • get inputsPendingValidation(): Input<any>[]
  • Returns the subset of inputs specified at instantiation time that is currently undergoing asynchronous domain validation.

    Returns Input<any>[]

isSubmitting

  • get isSubmitting(): boolean
  • Return true if the form is submitting.

    Returns boolean

name

  • get name(): null | string
  • Returns the UI state's debug name.

    Returns null | string

nextInput

  • get nextInput(): Input<any>
  • Returns the next input that the form should advance to. This is defined as the next input that contains an error. If that doesn't exist, it is the next input that the user has not yet confirmed.

    Returns Input<any>

normalizedInputValue

  • get normalizedInputValue(): InferInputGroupValue<TInputs>
  • Same as with value but each value is the current input value, normalized by each input's normalizer.

    see

    value

    Returns InferInputGroupValue<TInputs>

structure

  • get structure(): TInputs
  • Returns the structure of the input group. If the input structure contains subgroups, the subgroups are preserved here.

    Use inputs to get the input structure without subgroups.

    Use [[flattenedInputs]] to get an array of inputs whose order does not matter.

    see

    flattedInputs

    see

    inputs

    Returns TInputs

submitActionProgress

  • get submitActionProgress(): undefined | TActionProgress
  • Returns the progress of the submit action. This is null if the submit task is still in validation phase.

    Returns undefined | TActionProgress

submitResult

submitTask

unconfirmedInputs

  • get unconfirmedInputs(): Input<any>[]
  • Returns the subset of inputs specified at instantiation time that still have not be confirmed.

    Returns Input<any>[]

value

  • get value(): InferInputGroupValue<TInputs>
  • Returns a structure of confirmed input value that corresponds to the input structure passed to the constructor. For instance, if the constructor was instantiated with { a : someInput, b: someOuterInput }, the value here will also have the keys a and b whose value are the respective input values.

    see

    inputValue

    Returns InferInputGroupValue<TInputs>

confirm

  • confirm(args: object): void
  • Batch-confirm the inputs using the value that is provided in the group. Note that unlike individually confirming an input, this does not permit an option to advance the focus to the "next" input.

    Parameters

    • args: object

    Returns void

reset

  • reset(args?: undefined | object): void
  • Batch-reset the inputs using the value that is provided in the group. This is the same as calling reset on the individual input instances.

    Parameters

    • Optional args: undefined | object

    Returns void

submit

  • submit(): Promise<void>
  • Submits the form.export type

    Returns Promise<void>

Generated using TypeDoc