IFormProvide

interface
Form & Input

Provide/inject contract exposed by OrigamForm to its descendant fields — lets fields register/unregister themselves and report validation state back to the parent form.

TypeScript

Definition

The TypeScript interface definition as found in the origam source. Click the copy icon to copy the snippet.

typescript

API

Properties

Every property declared by this interface, with its type, optionality and default.

register
required
(item: { id: number | string vm: ComponentInternalInstance validate: () => Promise<Array<string>> reset: () => Promise<void> resetValidation: () => Promise<void> }) => void
Called by a field on mount to register itself with the parent form.
unregister
required
(id: number | string) => void
Called by a field on unmount to deregister itself.
update
required
(id: number | string, isValid: boolean | undefined, errorMessages: Array<string>) => void
Called by a field after validation to report its current valid state and error messages.
items
Ref<Array<IFormField>>
Reactive list of all registered fields.
isDisabled
required
ComputedRef<boolean>
Whether the form is disabled.
isReadonly
required
ComputedRef<boolean>
Whether the form is readonly.
isValidating
Ref<boolean>
True while form validation is running.
isValid
required
Ref<boolean | null | undefined>
Overall form validity.
validateOn
required
Ref<TValidateOn | undefined>
When validation should be triggered.

Ecosystem

Used by

Components and composables that extend or consume this interface.

Usage

Examples

Ready-to-paste code snippets using this interface.

Injecting IFormProvide inside a custom field

typescript