Web SDKv1.0.0

FormsApi.fields()

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.
methodReadingsince 1.0.0

Signature

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

Parameters

ParameterTypeDescription
pageIndex?numberZero-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.

Example

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

More in FormsApi