TX Text Control .NET Server

FormFieldCollection Object

Object|Introduced in 28.0

Description

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

Syntax

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.

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);

Members

Methods

MethodDescription
addCheckFormFieldAdds a new CheckFormField.
addDateFormFieldAdds a new DateFormField.
addSelectionFormFieldAdds a new SelectionFormField.
addTextFormFieldAdds a new TextFormField.
elementAtReturns the element at a specified index in the collection. (Inherited from Collection.)
forEachExecutes a callback function for each element. (Inherited from Collection.)
getCountGets the number of elements contained in the collection. (Inherited from Collection.)
getItemGets the form field at the current text input position or the form field with the specified id.
removeRemoves the form field from the Text Control document.