Javascript: FormattedText.getTextFieldsByType Method
Description
Returns an array of static text field information objects.
Syntax
<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.
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);