# Javascript: FormField.setDescriptiveText Method

> Sets the form field's descriptive text. An empty string or null can be used to delete a previously set text.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 34.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: FormField.setDescriptiveText Method
- **483 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formfield/setdescriptivetext-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formfield/setdescriptivetext-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/formfield/setdescriptivetext-method/llms-full.txt

---

### Description

Sets the form field's descriptive text. An empty string or null can be used to delete a previously set text.

### Syntax

```javascript
<void> FormField.setDescriptiveText(<string> value, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| value | The new property value. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `FormField.setDescriptiveText` in a practical document-editing workflow. It sets the form field's descriptive text. An empty string or null can be used to delete a previously set text.

```javascript
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.setDescriptiveText(
            "InvoiceNumber",
            function() {
                console.log("set descriptive text completed.");
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: FormField.getEnabled Method](https://docs.textcontrol.com/ds-server/reference/javascript/formfield/getenabled-method/llms-full.txt)
- **Next:** [Javascript: FormField.setEnabled Method](https://docs.textcontrol.com/ds-server/reference/javascript/formfield/setenabled-method/llms-full.txt)
