# FormFieldCollection Object

> The FormFieldCollection contains all form fields in a Text Control document or part of the document.

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

---

### Description

The FormFieldCollection contains all [form fields](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfield/llms-full.txt) in a Text Control document or part of the document.

### Syntax

```javascript
FormFieldCollection
```

### Examples

The following example demonstrates `FormFieldCollection` in a practical document-editing workflow. The FormFieldCollection contains all form fields in a Text Control document or part of the document.

```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.getItem(
        function(formField) {
            if (!formField) {
                console.warn("No form field was returned.");
                return;
            }
            
            console.log("get item result:", formField);
        },
        onTxError,
        25
    );
}, onTxError);
```

---

## In This Section

- [Javascript: FormFieldCollection.addCheckFormField Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfieldcollection/addcheckformfield-method/llms-full.txt): Adds a new CheckFormField.
- [Javascript: FormFieldCollection.addDateFormField Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfieldcollection/adddateformfield-method/llms-full.txt): Adds a new DateFormField.
- [Javascript: FormFieldCollection.addSelectionFormField Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfieldcollection/addselectionformfield-method/llms-full.txt): Adds a new SelectionFormField.
- [Javascript: FormFieldCollection.addTextFormField Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfieldcollection/addtextformfield-method/llms-full.txt): Adds a new TextFormField.
- [Javascript: FormFieldCollection.getItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfieldcollection/getitem-method/llms-full.txt): Gets the form field at the current text input position or the form field with the specified id.
- [Javascript: FormFieldCollection.remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfieldcollection/remove-method/llms-full.txt): Removes the form field from the Text Control document.

---

## Nearby

- **Previous:** [Javascript: FormField.setEnabled Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfield/setenabled-method/llms-full.txt)
- **Next:** [Javascript: FormFieldCollection.addCheckFormField Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formfieldcollection/addcheckformfield-method/llms-full.txt)
