DS Server

Javascript: TextFieldCollection.remove Method

Method|Introduced in 28.0

Description

Removes the text field from the Text Control document.

Syntax

<void> TextFieldCollection.remove(<TextField> textField, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
textField

Specifies the text field to remove.

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates TextFieldCollection.remove in a practical document-editing workflow. It removes the text field from the Text Control document.

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

function remove(textField) {
    TXTextControl.textParts.getMainText(function(mainText) {
        const textFields = mainText.textFields;
        textFields.remove(
            textField,
            function() {
                console.log("remove completed.");
            },
            onTxError
        );
    }, onTxError);
}