Javascript: FormFieldCollection.remove Method
Description
Removes the form field from the Text Control document.
Syntax
<void> FormFieldCollection.remove(<FormField> formField, [<RequestBooleanCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| formField | Specifies the form field to remove. |
| callback | Optional. Receives whether the form field could be removed. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates FormFieldCollection.remove in a practical document-editing workflow. It removes the form field from the Text Control document.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function remove(formField) {
TXTextControl.textParts.getMainText(function(mainText) {
const formFields = mainText.formFields;
formFields.remove(
formField,
function(result) {
if (result) {
console.log("remove is available.");
} else {
console.warn("remove is not available in the current document state.");
}
},
onTxError
);
}, onTxError);
}