TX Text Control .NET Server

Javascript: SelectionFormField.getSelectedIndex Method

Method|Introduced in 28.0

Description

Gets the index of the selected item of the SelectionFormField. If the property value is -1, no item is selected and the currently selected item is deselected.

Syntax

<void> SelectionFormField.getSelectedIndex(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the index of the selected item.

errorCallback

Optional. Is called when the operation failed with an error.

Examples

The following example demonstrates SelectionFormField.getSelectedIndex in a practical document-editing workflow. It gets the index of the selected item of the SelectionFormField. If the property value is -1, no item is selected and the currently selected item is deselected.

function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectSelectedIndex(selectionFormField) {
    selectionFormField.getSelectedIndex(
        function(result) {
            console.log("get selected index result:", result);
        },
        onTxError
    );
}