# Javascript: FormFieldCollection.addCheckFormField Method

> Adds a new CheckFormField.

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

---

### Description

Adds a new [CheckFormField](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/checkformfield/llms-full.txt).

### Syntax

```javascript
<void> FormFieldCollection.addCheckFormField(<boolean> isChecked, [<RequestCheckFormFieldCallback> callback], [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| isChecked | Specifies whether the checkbox is initially checked or unchecked. When this parameter is true, it is checked. |
| callback | Optional. Receives the added CheckFormField. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `FormFieldCollection.addCheckFormField` in a practical document-editing workflow. It adds a new CheckFormField.

```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.addCheckFormField(
        true,
        function(checkFormField) {
            if (!checkFormField) {
                console.warn("No check form field was returned.");
                return;
            }
            
            console.log("add check form field result:", checkFormField);
        },
        onTxError
    );
}, onTxError);
```

---

## Nearby

- **Previous:** [FormFieldCollection Object](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfieldcollection/llms-full.txt)
- **Next:** [Javascript: FormFieldCollection.addDateFormField Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfieldcollection/adddateformfield-method/llms-full.txt)
