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

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

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, resolver, args, setter, localizer?): DataValidator

Creates a DataValidator instance.

Type Parameters

T

the validation function factory arguments.

Parameters

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

DataValidator

the DataValidator instance.