Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Form<Params>

Type parameters

  • Params

Hierarchy

  • Form

Index

Properties

defaultValues

defaultValues: object

The form's default values. This is provided during the useForm call.

Type declaration

errors

errors: Errors<Params>

The object that holds all error messages for attributes. This is generated whenever you call Form.isValid or Form.isInvalid.

handleChange

handleChange: EventHandler

The input's onChange event handler. An exception will be raised if your input doesn't have a name attribute.

handleSubmit

handleSubmit: function

The form's onSubmit handler. It calls preventDefault() and delegates the original event to the provided handleSubmit param.

Type declaration

isInvalid

isInvalid: function

Run validations and return true if any validation fails.

Type declaration

    • (): boolean
    • Returns boolean

isValid

isValid: function

Run validations and return false if any validation fails.

Type declaration

    • (): boolean
    • Returns boolean

reset

reset: function

Reset the form's result.

  • Set values to defaultValues.
  • Reset errors.
  • Reset validations.

Type declaration

    • (): void
    • Returns void

setErrors

setErrors: function

Set form error messages. This can be useful to populate form errors out of HTTP responses.

Type declaration

    • (errors: Errors<Params>): void
    • Parameters

      Returns void

validations

validations: Validations<Params>

Hold all validations. This will be initialized whenever isValid or isInvalid functions are called.

values

values: Params

Hold the form's values. This will be initialized with any defaultValues provided during useForm call.

Generated using TypeDoc