Inserting Merge Fields
Deleting Merge Fields
Each time, merge fields (or any text field) should be manipulated, a new synchronized list of fields needs to be retrieved from Text Control. This is done using the method which returns a collection of either all text fields or only the text field at the current input position.
The following code deletes the merge field at the current input position:
Manipulating Merge Fields
The following code returns all available merge fields in the current text part. The method getTextFields returns all text fields. In order to filter the merge fields, the type and the typeName properties need to be checked:
Now, these fields can be manipulated. The following code sets the text of the first field in the created array of fields:
The following sample uses the Widget to show how a merge field can be added and removed from the document: