DS Server

Javascript: TextFrameCollection.getItemByName Method

Method|Introduced in 28.0

Description

Gets the text frame with the specified name.

Syntax

<void> TextFrameCollection.getItemByName(<RequestTextFrameCallback> callback, [<ErrorCallback> errorCallback], <string> name)

Parameters

ParameterDescription
callback

Receives the requested text frame or null if no text frame with the specified name exists.

errorCallback

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

name

The text frame's name.

Examples

The following example demonstrates TextFrameCollection.getItemByName in a practical document-editing workflow. It gets the text frame with the specified name.

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

TXTextControl.textFrames.getItemByName(
    function(textFrame) {
        if (!textFrame) {
            console.warn("No text frame was returned.");
            return;
        }
        
        console.log("get item by name result:", textFrame);
    },
    onTxError,
    "ApprovalStamp"
);