formcycle 8.4.3 - JavaScript for forms
    Preparing search index...

    Interface NumberFormatApiLifecycle

    The API for the lifecycle of NumberFormat elements, such as initialization and destruction.

    The API is available via $.xutil.numberFormat.lifecycle.

    interface NumberFormatApiLifecycle {
        destroy: (reference: any) => void;
        hasNumberFormat: (reference: any) => boolean;
        initialize: (
            element: HTMLElement,
            options?: Partial<NumberFormatOptions>,
        ) => string;
        initializeAll: (
            elements: any,
            options?: Partial<NumberFormatOptions>,
        ) => string[];
    }
    Index

    Properties

    destroy: (reference: any) => void

    Destroys the existing NumberFormat instance for all given elements.

    Type declaration

      • (reference: any): void
      • Parameters

        • reference: any

          The element to destroy the instance for.

        Returns void

    If the element does not have an NumberFormat instance.

    hasNumberFormat: (reference: any) => boolean

    Checks if the first of the given elements has an NumberFormat instance.

    Type declaration

      • (reference: any): boolean
      • Parameters

        • reference: any

          The element to check.

        Returns boolean

        True if the element has an NumberFormat instance, false otherwise.

    initialize: (
        element: HTMLElement,
        options?: Partial<NumberFormatOptions>,
    ) => string

    Initializes the AutoNumeric feature for the given element. Does nothing when the element was already initialized. Use initializeAll to initialize multiple elements at once.

    Type declaration

      • (element: HTMLElement, options?: Partial<NumberFormatOptions>): string
      • Parameters

        • element: HTMLElement

          The element to initialize the feature for.

        • Optionaloptions: Partial<NumberFormatOptions>

          The options to use for the feature.

        Returns string

        The ID of the newly created AutoNumeric instance. The empty string if no element was given, or if a selector was given that matches no elements.

    initializeAll: (
        elements: any,
        options?: Partial<NumberFormatOptions>,
    ) => string[]

    Initializes the AutoNumeric feature for the given elements. If any element is already initialized, it is skipped. Use initialize to initialize a single element.

    Type declaration

      • (elements: any, options?: Partial<NumberFormatOptions>): string[]
      • Parameters

        • elements: any

          The elements to initialize the feature for. Can be either a single element, a collection of elements, a JQuery wrapper of elements, or a CSS selector.

        • Optionaloptions: Partial<NumberFormatOptions>

          The options to use for the feature.

        Returns string[]

        The IDs of all AutoNumeric instance. Includes both newly created instances and instances that were already present. The array is empty if no elements were given, or if a selector was given that matches no elements.