Skip to main content

Introducing Workflow Engine, try for FREE workflowengine.io.

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

NameTypeDescription
valueanythe validated value.

Returns

Promise<undefined | ValidationResult[]>

the validation results.


sendValidationEvent

sendValidationEvent(value): void

Generates an event to perform validation.

Parameters

NameTypeDescription
valueanythe validated value.

Returns

void


validate

validate(value): Promise<undefined | string>

Performs a validation of the value.

Parameters

NameTypeDescription
valueanythe 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

NameDescription
Tthe validation function factory arguments.

Parameters

NameTypeDescription
storeIStorethe form viewer settings
resolverSchemaResolver<T>the validation function factory.
argsTthe validation function factory arguments.
setterSetter<undefined | string>the callback function called to set a validation error.
localizer?ErrorMessageLocalizerthe function that localizes validation error messages.

Returns

DataValidator

the DataValidator instance.