View as Markdown

API reference: @salmonui/core/validation

FieldValidatorContextinterface

import type { FieldValidatorContext } from '@salmonui/core/validation';
interface FieldValidatorContext {
    readonly name: string;
    readonly formData: FormDataLike | null;
    readonly isNew: false;
}

Context of a form field's custom validators (@salmonui/inputs/form Field). It is passed as both the row and the ctx argument, so validate(value, { formData }) reads other fields.

FieldValidatorContext members (3)
NameSignatureDescription
namereadonly name: string;

The field's name ('' without one).

formDatareadonly formData: FormDataLike | null;

The owning form's data at validation time; null outside a form.

isNewreadonly isNew: false;