formcycle 8.5.4-SNAPSHOT - JavaScript for forms
    Preparing search index...

    Interface NumberFormatApiGet

    The API for getting information from NumberFormat elements, such as the current value.

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

    For example, to get the value of an element as a number, use $.xutil.numberFormat.get.valueNumeric(...).

    // 12.12345
    $.xutil.numberFormat.get.valueNumeric(".tf1");
    interface NumberFormatApiGet {
        options: (
            reference: NumberFormatInstanceReference,
        ) => NumberFormatOptions;
        valueFormatted: (reference: NumberFormatInstanceReference) => string;
        valueNumeric: (
            reference: NumberFormatInstanceReference,
        ) => number | undefined;
        valueNumericString: (reference: NumberFormatInstanceReference) => string;
    }
    Index

    Properties

    Gets the current options of the first of the given NumberFormat elements. Throws when the element does not have a NumberFormat instance.

    Type Declaration

    If the element does not have a NumberFormat instance.

    valueFormatted: (reference: NumberFormatInstanceReference) => string

    Gets the current value of the first of the given NumberFormat elements as a formatted string, according to the current options. When the NumberFormat element is empty, returns an empty string. Throws when the element does not have a NumberFormat instance.

    Type Declaration

    // "$ 12.3400"
    $.xutil.numberFormat.get.valueFormatted(".tf1");

    If the element does not have a NumberFormat instance.

    valueNumeric: (reference: NumberFormatInstanceReference) => number | undefined

    Gets the current value of the first of the given NumberFormat elements, as a number. When the NumberFormat element is empty, returns undefined. Throws when the element does not have a NumberFormat instance.

    Type Declaration

    // 12.12345
    $.xutil.numberFormat.get.valueNumeric(".tf1");

    If the element does not have an NumberFormat instance.

    valueNumericString: (reference: NumberFormatInstanceReference) => string

    Gets the current value of the first of the given NumberFormat elements as a numerical string. When the NumberFormat element is empty, returns an empty string. Throws when the element does not have an NumberFormat instance.

    This is similar to valueNumeric, but returns the value as a string instead of a number. This prevents issues with floating point precision.

    Type Declaration

    // "12.123456789"
    $.xutil.numberFormat.get.valueNumericString(".tf1");

    If the element does not have a NumberFormat instance.