SAS logoSAS® Mobile Investigator API
    Preparing search index...

    Interface SmiSingleValueControlFormApi

    An API of methods and properties for forms on a single value control.

    interface SmiSingleValueControlFormApi {
        addValidator(
            validator: () => { [errorName: string]: string } | null,
        ): () => void;
        getErrors(): { [error: string]: string } | null;
        getValidationMessageId(): string | undefined;
        isDirty(): boolean;
        isInvalid(): boolean;
        isTouched(): boolean;
        isValid(): boolean;
        markAsDirty(): void;
        markAsPristine(): void;
        markAsTouched(): void;
        onShowInvalidChange(callback: (showInvalid: boolean) => void): () => void;
        onValidityChange(callback: (valid: boolean) => void): () => void;
        reset(): void;
        setErrors(errors: { [error: string]: string } | null): void;
        showInvalid(): boolean;
    }
    Index

    Methods

    • Adds a validator function to the control. Returns an error object, or null if there are no errors. to the control.

      Parameters

      • validator: () => { [errorName: string]: string } | null

        The validator function to add.

      Returns () => void

      A function that removes the validator.

    • Returns all errors for the control.

      Returns { [error: string]: string } | null

      An object containing the errors or null.

    • Returns string | undefined

      The id of the element that is showing a validation message for the control or returns undefined if there is no message being shown.

    • Returns whether the control is dirty. A control is dirty after the user has changed the value of the control.

      Returns boolean

      A boolean value describing if the control is dirty.

    • Gives whether the control is invalid.

      Returns boolean

      A boolean value describing if the control is invalid.

    • Returns whether the control is touched. A control is touched after the user has triggered a blur event on it.

      Returns boolean

      A boolean value describing if the control has been touched.

    • Returns whether the control is valid.

      Returns boolean

      A boolean value describing if the control is valid.

    • Marks the control as dirty.

      Returns void

    • Marks the control as pristine.

      Returns void

    • Marks the control as touched.

      Returns void

    • Runs a callback when the the control's show invalid state changes.

      Parameters

      • callback: (showInvalid: boolean) => void

      Returns () => void

      A function that removes the callback.

    • Runs a callback when the the control's validity changes.

      Parameters

      • callback: (valid: boolean) => void

        A callback that is invoked with the valid state.

      Returns () => void

      A function that removes the callback.

    • Resets the form control, marking it pristine and untouched.

      Returns void

    • Sets the given error on the control.

      Parameters

      • errors: { [error: string]: string } | null

        The errors object.

      Returns void

    • Returns whether the control should show itself as being invalid.

      Returns boolean

      A boolean value indicating whether the control should show itself as being invalid.