# Javascript: SubTextPart.getTextFields Method

> Returns an array of static text field information objects.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 32.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: SubTextPart.getTextFields Method
- **530 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/gettextfields-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/gettextfields-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/gettextfields-method/llms-full.txt

---

### Description

Returns an array of static text field information objects.

### Syntax

```javascript
<void> SubTextPart.getTextFields(<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 `SubTextPart.getTextFields` 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(mainText) {
    const subTextParts = mainText.subTextParts;
    subTextParts.getItem(function(subTextPart) {
        if (!subTextPart) {
            console.warn("No sub text part is available at the current input position.");
            return;
        }
    
        subTextPart.getTextFields(
            TXTextControl.TextFieldType.ApplicationField,
            function(textFields) {
                if (!textFields) {
                    console.warn("No text field info was returned.");
                    return;
                }
                
                console.log("get text fields result:", textFields);
            },
            onTxError
        );
    }, onTxError);
}, onTxError);
```

---

## Nearby

- **Previous:** [Javascript: SubTextPart.getText Method](https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/gettext-method/llms-full.txt)
- **Next:** [Javascript: SubTextPart.save Method](https://docs.textcontrol.com/ds-server/reference/javascript/subtextpart/save-method/llms-full.txt)
