# Javascript: FormFieldCollection.remove Method

> Removes the form field from the Text Control document.

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

---

### Description

Removes the form field from the Text Control document.

### Syntax

```javascript
<void> FormFieldCollection.remove(<FormField> formField, [<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| formField | Specifies the form field to remove. |
| callback | Optional. Receives whether the form field could be removed. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `FormFieldCollection.remove` in a practical document-editing workflow. It removes the form field from the Text Control document.

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

function remove(formField) {
    TXTextControl.textParts.getMainText(function(mainText) {
        const formFields = mainText.formFields;
        formFields.remove(
            formField,
            function(result) {
                if (result) {
                    console.log("remove is available.");
                } else {
                    console.warn("remove is not available in the current document state.");
                }
            },
            onTxError
        );
    }, onTxError);
}
```

---

## Nearby

- **Previous:** [Javascript: FormFieldCollection.getItem Method](https://docs.textcontrol.com/ds-server/reference/javascript/formfieldcollection/getitem-method/llms-full.txt)
- **Next:** [FrameBase Object](https://docs.textcontrol.com/ds-server/reference/javascript/framebase/llms-full.txt)
