TX Text Control .NET Server

Javascript: ApplicationField.getFormat Method

Method|Introduced in 28.0

Description

Gets the field's format.

Syntax

<void> ApplicationField.getFormat(<RequestNumberCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the position of the first character of the text field.

errorCallback

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

Examples

The following example demonstrates ApplicationField.getFormat in a practical document-editing workflow. It gets the field's format.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const applicationFields = mainText.applicationFields;
    applicationFields.getItem(function(applicationField) {
        if (!applicationField) {
            console.warn("No application field is available at the current input position.");
            return;
        }
    
        applicationField.getFormat(
            function(result) {
                console.log("get format result:", result);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);