Skip to main content

Introducing Workflow Engine, try for FREE workflowengine.io.

Class: Form

@react-form-builder/core.Form

Represents a form that is rendered in Viewer or edited in Builder.

Constructors

constructor

new Form(componentTree, localization, actions, languages, defaultLanguage)

Creates a new instance of Form.

Parameters

NameTypeDescription
componentTreeComponentDatathe root component of the form.
localizationLocalizationStorethe localization of the form.
actionsActionValuesthe form custom actions.
languagesLanguage[]the localization languages of the form.
defaultLanguageLanguagethe default localization language of the form.

Properties

actions

Readonly actions: ActionValues

The set of action definitions.


componentTree

Readonly componentTree: ComponentData

Root component of the form.


defaultLanguage

defaultLanguage: Language

Default localization language of the form.


errorProps

errorProps: any = {}

Properties of the component displaying the error.


errorType

Optional errorType: string

The type name of the component displaying the error.


languages

Readonly languages: Language[] = []

Localization languages of the form.


localization

Readonly localization: LocalizationStore

Localization of the form.


tooltipType

Optional tooltipType: string

The type name of the component displaying the tooltip.

Accessors

actionNames

get actionNames(): string[]

Returns

string[]

the actions names array.

Methods

cloneAction

cloneAction(namedAction): void

Clones the action.

Parameters

NameTypeDescription
namedActionNamedActionDefinitionthe named action to clone.

Returns

void


dispose

dispose(): void

Disposes the form. Disposes all the components and localization.

Returns

void


initFields

initFields(): void

Initializes form fields.

Returns

void


removeAction

removeAction(name): void

Removes the action from the form.

Parameters

NameTypeDescription
namestringthe action name to remove.

Returns

void


updateOrAddAction

updateOrAddAction(oldActionName, newAction): void

Changes the existing action to the new one, adds the action if the existing action is not found.

Parameters

NameTypeDescription
oldActionNamestringthe existing action name.
newActionNamedActionDefinitionthe new named action.

Returns

void