# Javascript: TXTextControl.removeTextField Method

> Obsolete. This method will be removed in one of the next versions. The removeTextField method removes a text field from the document.

> **Note:** This is deprecated and should not be used in new work.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 25.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TXTextControl.removeTextField Method
- **330 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/removetextfield-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/removetextfield-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/removetextfield-method/llms-full.txt

---

### Description

`Obsolete. This method will be removed in one of the next versions.` The removeTextField method removes a text field from the document.

### Syntax

```javascript
<void> TXTextControl.removeTextField(<TextField> textField, <boolean> keepText)
```

### Parameters

| Parameter | Description |
|---|---|
| textField | The text field to remove from the document. Allowed types are [TextField](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol-textfield/llms-full.txt) and [ApplicationField](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol-applicationfield/llms-full.txt). Must have been retrieved with [getTextFields](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/gettextfields-method/llms-full.txt) beforehand. |
| keepText | If this parameter is set to true, the field is removed without deleting its visible text. Otherwise, the field's text is also deleted. |

### Examples

The following example demonstrates `TXTextControl.removeTextField` in a practical document-editing workflow. Obsolete. This method will be removed in one of the next versions. The removeTextField method removes a text field from the document.

```javascript
function removeTextField(textField) {
    TXTextControl.removeTextField(textField, true);
}
```

---

## Nearby

- **Previous:** [Javascript: TXTextControl.removeFromDom Method](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/removefromdom-method/llms-full.txt)
- **Next:** [Javascript: TXTextControl.resetContents Method](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/resetcontents-method/llms-full.txt)
