Class: TemplateField
@react-form-builder/core.TemplateField
The field with the form data, contains the value of the nested form. Internal use only.
Implements
Constructors
constructor
• new TemplateField(componentStore
, viewerStore
)
Creates the nested form field with form data for the component.
Parameters
Name | Type | Description |
---|---|---|
componentStore | ComponentStore | the component settings. |
viewerStore | IStore | viewerStore the form viewer settings. |
Properties
componentStore
• Readonly
componentStore: ComponentStore
the component settings.
touched
• touched: boolean
= false
Flag, true, if the field is marked as touched.
Implementation of
valued
• valued: string
= ''
The name of the component property that contains the field value.
Implementation of
viewerStore
• Readonly
viewerStore: IStore
viewerStore the form viewer settings.
Accessors
errors
• get
errors(): Record
<string
, unknown
>
Contains a field validation errors if the field provides multiple errors (i.e. field is template).
Returns
Record
<string
, unknown
>
Implementation of
form
• get
form(): ComponentData
Returns
the form for the field.
storeDataInParentForm
• get
storeDataInParentForm(): any
Flag, false if nested form data show as nested object, true otherwise.
Returns
any
Implementation of
value
• get
value(): unknown
Value of the field.
Returns
unknown
Implementation of
Methods
clear
▸ clear(): void
Clears the data in the field.
Returns
void
Implementation of
Field.clear
dispose
▸ dispose(): void
Releases allocated resources, must be used when destroying an object instance.
Returns
void
Implementation of
Field.dispose
getValidationResult
▸ getValidationResult(): Promise
<undefined
>
Returns the validation results without triggering an events and changing the state of the form.
Returns
Promise
<undefined
>
the ValidationMessages validation results.
Implementation of
Field.getValidationResult
init
▸ init(): void
Initializes the value of the field.
Returns
void
Implementation of
Field.init
reset
▸ reset(): void
Sets the field to its default value.
Returns
void
Implementation of
Field.reset
setError
▸ setError(error
): void
Sets the error value.
Parameters
Name | Type | Description |
---|---|---|
error | unknown | The error value to be set. |
Returns
void
Implementation of
Field.setError
setTouched
▸ setTouched(): void
Marks the field as touched.
Returns
void
Implementation of
Field.setTouched
setValue
▸ setValue(value
): void
Sets the value of the field.
Parameters
Name | Type | Description |
---|---|---|
value | unknown | the value. |
Returns
void
Implementation of
Field.setValue
validate
▸ validate(): Promise
<void
>
Validates the field value.
Returns
Promise
<void
>
Implementation of
Field.validate