# FormsApi.fields()

```ts
fields(pageIndex?: number): Promise<FormFieldInfo[]>
```

The form's fields as the document holds them — every widget with its name, type, options, the booleans its flags set and the value the file carries (a check box's or radio button's export value when on, `'Off'` when off, as `getValues()` speaks it) — on one page, or on every page when the index is omitted. For what a viewer shows now, see `getValues()`. A document is read as at most 16 384 widgets: past that many, the rest of the form is left as the pages paint it, and `setValues()` reports those fields as `unknown_field`. Needs the `extract` feature.

- Kind: method
- Since: 1.0.0

| Parameter | Type | Description |
| --- | --- | --- |
| `pageIndex?` | `number` | Zero-based page index. Omit for every page. |

Returns `Promise<FormFieldInfo[]>`: Each with `name`, `type`, `value`, `pageIndex`, `rect`, `readOnly`, `required`, `noExport`, `multiline`, `password`, `comb`, `multiSelect`, `hidden` and, where set, `options`, `maxLength`, `exportValue`, `dateFormat`, `signature`, `format`, `range`, `calculation`, `look` and `rotation`.

Throws:

- `INVALID_ARGUMENT` — a page index out of range.
- `FEATURE_NOT_LICENSED` — the license lacks `extract`.
- `DOCUMENT_CLOSED` — the document has been closed.

```ts
const required = (await doc.forms.fields()).filter((f) => f.required && f.value === '');
```

Part of [FormsApi](https://kernstra.com/docs/web-sdk/api/doc-forms) in the Kernstra Web SDK 1.0.0 API reference.

Web page: https://kernstra.com/docs/web-sdk/api/doc-forms/fields
