Skip to main content

Introducing Workflow Engine, try for FREE workflowengine.io.

Class: DataValidator

Binds all parts of the validation and performs the validation.

Methods

getValidationResult()

getValidationResult(value): Promise<undefined | ValidationResult[]>

Returns the validation results without triggering an events and changing the state of the form.

Parameters

value

any

the validated value.

Returns

Promise<undefined | ValidationResult[]>

the validation results.


sendValidationEvent()

sendValidationEvent(value): void

Generates an event to perform validation.

Parameters

value

any

the validated value.

Returns

void


validate()

validate(value): Promise<undefined | string>

Performs a validation of the value.

Parameters

value

any

the validated value.

Returns

Promise<undefined | string>

the Promise with the result of the validation.


create()

static create<T>(store, getFormData, resolver, args, setter, localizer?): DataValidator

Creates a DataValidator instance.

Type Parameters

T

T

the validation function factory arguments.

Parameters

store

IStore

the form viewer settings.

getFormData

() => IFormData

the function that returns a form data.

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

DataValidator

the DataValidator instance.