# Javascript: TextViewGeneratorColors.setActiveFormFieldColor Method

> Sets the highlight color of a form field containing the current text input position. To suppress highlighting the active FormField the property value can be set to null.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: TextViewGeneratorColors.setActiveFormFieldColor Method
- **384 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textviewgeneratorcolors/setactiveformfieldcolor-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textviewgeneratorcolors/setactiveformfieldcolor-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textviewgeneratorcolors/setactiveformfieldcolor-method/llms-full.txt

---

### Description

Sets the highlight color of a form field containing the current text input position. To suppress highlighting the active FormField the property value can be set to null.

### Syntax

```javascript
<void> TextViewGeneratorColors.setActiveFormFieldColor(<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.setActiveFormFieldColor` in a practical document-editing workflow. It sets the highlight color of a form field containing the current text input position. To suppress highlighting the active 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.setActiveFormFieldColor(
    "#ffd54f",
    function() {
        console.log("set active form field color completed.");
    },
    onTxError
);
```

---

## Nearby

- **Previous:** [Javascript: TextViewGeneratorColors.resetLightShadowColor Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textviewgeneratorcolors/resetlightshadowcolor-method/llms-full.txt)
- **Next:** [Javascript: TextViewGeneratorColors.setDarkShadowColor Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/textviewgeneratorcolors/setdarkshadowcolor-method/llms-full.txt)
