# Javascript: TextViewGeneratorColors.setFormFieldColor Method

> Sets the default highlight color of a form field. To suppress highlighting the FormField the property value can be set to null.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TextViewGeneratorColors.setFormFieldColor Method
- **364 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textviewgeneratorcolors/setformfieldcolor-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textviewgeneratorcolors/setformfieldcolor-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/textviewgeneratorcolors/setformfieldcolor-method/llms-full.txt

---

### Description

Sets the default highlight color of a form field. To suppress highlighting the FormField the property value can be set to null.

### Syntax

```javascript
<void> TextViewGeneratorColors.setFormFieldColor(<string> color, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| color | The highlight color. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TextViewGeneratorColors.setFormFieldColor` in a practical document-editing workflow. It sets the default highlight color of a form field. To suppress highlighting the FormField the property value can be set to null.

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

TXTextControl.displayColors.setFormFieldColor(
    "#ffd54f",
    function() {
        console.log("set form field color completed.");
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: TextViewGeneratorColors.setDesktopColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/textviewgeneratorcolors/setdesktopcolor-method/llms-full.txt)
- **Next:** [Javascript: TextViewGeneratorColors.setHeaderFooterLabelColor Method](https://docs.textcontrol.com/ds-server/reference/javascript/textviewgeneratorcolors/setheaderfooterlabelcolor-method/llms-full.txt)
