Skip to main content
zerotal

Documentation


Documentation / @zerotal/flow / index / ErrorsProxy

Interface: ErrorsProxy

Defined in: flow/src/Component.ts:65

Indexable

[field: string]: ErrorField | ((...args) => unknown)

Methods

has()

has(field): boolean

Defined in: flow/src/Component.ts:67

True when the given field has at least one error.

Parameters

field

string

Returns

boolean


any()

any(): boolean

Defined in: flow/src/Component.ts:69

True when any field has an error.

Returns

boolean


add()

Call Signature

add(field, message): void

Defined in: flow/src/Component.ts:78

Add one or more validation errors manually.

Parameters
field

string

message

string

Returns

void

Example
this.errors.add("email", "Invalid email or password.");
this.errors.add({ email: "Invalid email or password." });
this.errors.add({ password: ["Too short", "Needs a number"] });

Call Signature

add(errors): void

Defined in: flow/src/Component.ts:79

Parameters
errors

Record<string, string | string[]>

Returns

void


clear()

clear(field?): void

Defined in: flow/src/Component.ts:81

Clear errors — all fields, or just the named one.

Parameters

field?

string

Returns

void