The plugin added to fields by the constraintValidationPlugin.

interface ConstraintValidationPlugin {
    isInvalid: boolean;
    validatedElement: null | ValidatableElement;
    validity: null | ValidityState;
    getInvalidFields(): BareField<any, any>[];
    on(eventType: "change:validity", subscriber: Subscriber<null | ValidityState, any>): Unsubscribe;
    ref(element: null | Element): void;
    reportValidity(): boolean;
}

Properties

isInvalid: boolean

true if this field has a validity issue, or false otherwise.

validatedElement: null | ValidatableElement

The DOM element that supports the Constraint validation API associated with the field, or null if there's no such element.

validity: null | ValidityState

The copy of the last reported validity state read from the validatedElement, or null if there's no associated validatable element.

Methods

  • Returns all invalid fields.

    Returns BareField<any, any>[]

  • Subscribes to the validity changes of this field or any of its descendants.

    Parameters

    • eventType: "change:validity"

      The type of the event.

    • subscriber: Subscriber<null | ValidityState, any>

      The subscriber that would be triggered.

    Returns Unsubscribe

    The callback to unsubscribe the subscriber.

  • Associates the field with the DOM element.

    Parameters

    Returns void

  • Shows error message balloon for the first element that is associated with this field or any of its child fields, that has an associated error via calling reportValidity.

    Returns boolean

    true if a field doesn't have an error, or false otherwise.