TX Text Control .NET Server

Javascript: SubTextPart.getTextFields Method

Method|Introduced in 32.0

Description

Returns an array of static text field information objects.

Syntax

<void> SubTextPart.getTextFields(<TextFieldType> fieldType, <RequestTextFieldInfoArrayCallback> callback, <ErrorCallback> errorCallback)

Parameters

ParameterDescription
fieldType

A combination of one or more field types.

callback

Receives the array of text field information objects.

errorCallback

Is called when the operation failed with an error.

Examples

The following example demonstrates SubTextPart.getTextFields in a practical document-editing workflow. It returns an array of static text field information objects.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const subTextParts = mainText.subTextParts;
    subTextParts.getItem(function(subTextPart) {
        if (!subTextPart) {
            console.warn("No sub text part is available at the current input position.");
            return;
        }
    
        subTextPart.getTextFields(
            TXTextControl.TextFieldType.ApplicationField,
            function(textFields) {
                if (!textFields) {
                    console.warn("No text field info was returned.");
                    return;
                }
                
                console.log("get text fields result:", textFields);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);