Javascript: TextFieldCollection.clear Method
Description
Removes all text fields from a Text Control document.
Syntax
<void> TextFieldCollection.clear([<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates TextFieldCollection.clear in a practical document-editing workflow. It removes all text fields from a Text Control document.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
TXTextControl.textParts.getMainText(function(mainText) {
const textFields = mainText.textFields;
textFields.clear(
function() {
console.log("clear completed.");
},
onTxError
);
}, onTxError);