Skip to content

FieldValidation

Defined in: src/widgets/controls/validation.ts:139

Per-field validation state + behavior, embedded in a control widget. Keeps the control’s invalid flag and resolved border/icon color in sync with the latest result, and reports the message for the shared/inline display layers.

new FieldValidation(field): FieldValidation

Defined in: src/widgets/controls/validation.ts:151

ValidatableField

FieldValidation

optional onValidate?: (result) => void

Defined in: src/widgets/controls/validation.ts:147

Called after each validation with the normalized result.

ValidationResult

void


result: ValidationResult = VALID

Defined in: src/widgets/controls/validation.ts:145

The latest validation result.


touched: boolean = false

Defined in: src/widgets/controls/validation.ts:149

Becomes true after the field’s first validation, gating eager display.


validateOn: ValidateTrigger = "blur"

Defined in: src/widgets/controls/validation.ts:143

When the field re-validates itself.


validators: Validator<any>[] = []

Defined in: src/widgets/controls/validation.ts:141

Validators run against the field’s value, in order.

get invalid(): boolean

Defined in: src/widgets/controls/validation.ts:154

True when the field has been validated and is currently invalid.

boolean


get message(): string | undefined

Defined in: src/widgets/controls/validation.ts:159

The current error message when invalid, else undefined.

string | undefined


get severity(): Severity | undefined

Defined in: src/widgets/controls/validation.ts:164

The current severity when invalid, else undefined.

Severity | undefined

maybeValidate(trigger): void

Defined in: src/widgets/controls/validation.ts:178

Re-validates only if the configured trigger matches the given event.

ValidateTrigger

void


resolveColor(): string | null

Defined in: src/widgets/controls/validation.ts:187

Resolves the theme color for the current severity, or null when valid.

string | null


validate(): ValidationResult

Defined in: src/widgets/controls/validation.ts:169

Runs validators against the field’s current value and stores the result.

ValidationResult