DS Server

Javascript: FormField.getEnabled Method

Method|Introduced in 31.0

Description

Gets a value indicating whether the form field is enabled.

Syntax

<void> FormField.getEnabled(<RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])

Parameters

ParameterDescription
callback

Receives the current property value.

errorCallback

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

Examples

The following example demonstrates FormField.getEnabled in a practical document-editing workflow. It gets a value indicating whether the form field is enabled.

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

TXTextControl.textParts.getMainText(function(mainText) {
    const formFields = mainText.formFields;
    formFields.getItem(function(formField) {
        if (!formField) {
            console.warn("No form field is available at the current input position.");
            return;
        }
    
        formField.getEnabled(
            function(result) {
                if (result) {
                    console.log("get enabled is available.");
                } else {
                    console.warn("get enabled is not available in the current document state.");
                }
            },
            onTxError
        );
    }, onTxError);
}, onTxError);