# Javascript: FormattedText.getTextFieldsByType Method

> Returns an array of static text field information objects.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 32.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: FormattedText.getTextFieldsByType Method
- **431 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formattedtext/gettextfieldsbytype-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formattedtext/gettextfieldsbytype-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formattedtext/gettextfieldsbytype-method/llms-full.txt

---

### Description

Returns an array of static text field information objects.

### Syntax

```javascript
<void> FormattedText.getTextFieldsByType(<TextFieldType> fieldType, <RequestTextFieldInfoArrayCallback> callback, <ErrorCallback> errorCallback)
```

### Parameters

| Parameter | Description |
|---|---|
| fieldType | A combination of one or more field types. |
| callback | Receives the array of text field information objects. |
| errorCallback | Is called when the operation failed with an error. |

### Examples

The following example demonstrates `FormattedText.getTextFieldsByType` in a practical document-editing workflow. It returns an array of static text field information objects.

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

TXTextControl.textParts.getMainText(function(formattedText) {
    formattedText.getTextFieldsByType(
        TXTextControl.TextFieldType.ApplicationField,
        function(textFields) {
            if (!textFields) {
                console.warn("No text field info was returned.");
                return;
            }
            
            console.log("get text fields by type result:", textFields);
        },
        onTxError
    );
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: FormattedText.frames Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formattedtext/frames-property/llms-full.txt)
- **Next:** [Javascript: FormattedText.hypertextLinks Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/formattedtext/hypertextlinks-property/llms-full.txt)
