TX Text Control .NET Server

Javascript: EditableRegion.setUserName Method

Method|Introduced in 28.0

Description

Sets the name of the user who can edit the region. This parameter can be null or an empty string to indicate, that no user name has been specified and the region can be edited by everyone.

Syntax

<void> EditableRegion.setUserName(<string> username, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
username

The name of the user who can edit the region.

callback

Optional. Is called when the operation completed.

errorCallback

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

Examples

The following example demonstrates EditableRegion.setUserName in a practical document-editing workflow. It sets the name of the user who can edit the region. This parameter can be null or an empty string to indicate, that no user name has been specified and the region can be edited by everyone.

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

function configureUserName(editableRegion) {
    editableRegion.setUserName(
        "Tim Typer",
        function() {
            console.log("set user name completed.");
        },
        onTxError
    );
}