Class: DataValidator
@react-form-builder/core.DataValidator
Binds all parts of the validation and performs the validation.
Methods
dispose
▸ dispose(): void
Releases allocated resources, must be used when destroying an object instance.
Returns
void
getValidationResult
▸ getValidationResult(value
): Promise
<undefined
| ValidationResult
[]>
Returns the validation results without triggering an events and changing the state of the form.
Parameters
Name | Type | Description |
---|---|---|
value | any | the validated value. |
Returns
Promise
<undefined
| ValidationResult
[]>
the validation results.
sendValidationEvent
▸ sendValidationEvent(value
): void
Generates an event to perform validation.
Parameters
Name | Type | Description |
---|---|---|
value | any | the validated value. |
Returns
void
validate
▸ validate(value
): Promise
<undefined
| string
>
Performs a validation of the value.
Parameters
Name | Type | Description |
---|---|---|
value | any | the validated value. |
Returns
Promise
<undefined
| string
>
the Promise with the result of the validation.
create
▸ Static
create<T
>(store
, resolver
, args
, setter
, localizer?
): DataValidator
Creates a DataValidator instance.
Type parameters
Name | Description |
---|---|
T | the validation function factory arguments. |
Parameters
Name | Type | Description |
---|---|---|
store | IStore | the form viewer settings |
resolver | SchemaResolver <T > | the validation function factory. |
args | T | the validation function factory arguments. |
setter | Setter <undefined | string > | the callback function called to set a validation error. |
localizer? | ErrorMessageLocalizer | the function that localizes validation error messages. |
Returns
the DataValidator instance.