The addEventListener function registers event listener functions on the TXTextControl object.

<void> TXTextControl.addEventListener(<string> eventName, <function> callback)

Parameters

Parameter Description
eventName A string representing the name of the event to listen for.
Event Description
"barcodeCreated" Is fired when a new barcode has been created.
"barcodeDeleted" Is fired when a barcode has been deleted.
"barcodeDeselected" Is fired when a barcode has been deselected.
"barcodeSelected" Is fired when a barcode has been selected.
"blur" Is fired when the document editor has lost focus.
"cannotTrackChange" Is fire when a change of the document cannot be added to the list of tracked changes.
"changed" Is fired when the document's content is changed.
"charFormatChanged" Is fired when the character formatting attributes either of the selected characters or the current text input position have been changed.
"chartCreated" Is fired when a new chart has been created.
"chartDeleted" Is fired when a chart has been deleted.
"chartDeselected" Is fired when a chart has been deselected.
"chartSelected" Is fired when a chart has been selected.
"clipboardDataTransferAborted" Is fired when an ongoing clipboard data transfer is aborted.
"clipboardDataTransferComplete" Is fired when a clipboard data transfer is completed.
"clipboardDataTransferProgress" Is fired for each transfered clipboard data packet.
"clipboardDataTransferStart" Is fired when a clipboard data transfer starts.
"clipboardModeChanged" Is fired when the clipboard mode has changed.
"commentChanged" Is fired when the text of a comment has been altered.
"commentCreated" Is fired when a comment has been created.
"commentDeleted" Is fired when a comment has been deleted.
"commentedTextEntered" Is fired when the current input position has been moved to a position that belongs to a commented piece of text.
"commentedTextLeft" Is fired when the current input position has left a commented piece of text.
"commentStateChanged" Is fired when the state of a comment alters from active to inactive or vice versa.
"contentsReset" Is fired when all text contents have been deleted and all attributes have been reset to the state after initialization.
"contextMenuOpening" Is fired when the context menu opens.
"documentLinkClicked" Is fired when a text field has been clicked on that represents a link to a target in the document.
"documentLoaded" Is fired after a document has been loaded.
"documentSizeChanged" Is fired when the document's size is changed.
"drawingActivated" Is fired when a drawing has been activated.
"drawingCreated" Is fired when a new drawing has been created.
"drawingDeactivated" Is fired when a drawing has been deactivated.
"drawingDeleted" Is fired when a drawing has been deleted.
"drawingDeselected" Is fired when a drawing has been deselected.
"drawingSelected" Is fired when a drawing has been selected.
"editableRegionCreated" Is fired when an editable region has been created.
"editableRegionDeleted" Is fired when an editable region has been deleted.
"editableRegionEntered" Is fired when the current input position has been moved to a position that belongs to an editable region.
"editableRegionLeft" Is fired when the current input position has left an editable region.
"fileDropped" Is fired when a file is dragged and dropped onto the control.
"focus" Is fired when the document editor has received focus.
"footnoteCreated" Is fired when a footnote has been created.
"footnoteDeleted" Is fired when a footnote has been deleted.
"footnoteReferenceMarkEntered" Is fired when the current input position has been moved to the position of a footnote reference mark.
"footnoteReferenceMarkLeft" Is fired when the current input position has left the position of a footnote reference mark.
"footnoteSectionActivated" Is fired when the footnote section of a document's page gets the current text input position from another part of the document
"footnoteSectionDeactivated" Is fired when the footnote section of a document's page has loast the current text input position.
"formFieldCheckChanged" Is fired when the checkmark of a check form field has been changed from checked to unchecked or vice versa.
"formFieldDateChanged" Is fired when the date of a date rorm field has been changed.
"formFieldSelectionChanged" Is fired when the selected item of a selection form field has been changed.
"formFieldTextChanged" Is fired when the text of a text form field has been changed.
"frameDeselected" Is fired when a frame (image, text frame, chart, barcode or drawing) has been deselected.
"frameMoved" Is fired when a frame (image, text frame, chart, barcode or drawing) has been moved.
"frameSelected" Is fired when a frame (image, text frame, chart, barcode or drawing) has been selected.
"frameSized" Is fired when a frame (image, text frame, chart, barcode or drawing) has been sized.
"headerFooterActivated" Is fired when a header or footer gets the current text input position from another part of the document such as a text frame or the main text.
"headerFooterDeactivated" Is fired when a header or footer loses the current text input position and another part of the document such as a text frame or the main text gets it.
"hypertextLinkClicked" Is fired when a text field has been clicked on that represents the source of a hypertext link.
"hyphenateWord" Is fired, if a word does not fit in the line and must be hyphenated.
"imageCreated" Is fired when a new image has been created.
"imageDeleted" Is fired when an image has been deleted.
"imageDeselected" Is fired when an image has been deselected.
"imageSelected" Is fired when an image has been selected.
"inputParagraphChanged" Is fired when the text input position has been moved to another paragraph.
"inputPositionChanged" Is fired when the text input position has changed.
"mainTextActivated" Is fired when the main text of the document gets the current text input position from another part of the document, such as a header, a footer or a text frame.
"pageFormatChanged" Is fired when the page format settings have been changed.
"paragraphFormatChanged" Is fired when the formatting attributes of the selected paragraphs have been changed.
"removeCombobox" Is fired when a combobox for a SelectionFormField must be removed
"ribbonTabLoaded" Is fired each time a ribbon tab has been loaded.
"ribbonTabsLoaded" Is fired after the ribbon bar content has been loaded completely and the server supplied string resources have been applied.
"ribbonTabIndexChanged" Is fired after the current ribbon tab index has changed.
"signatureFieldCreated" Is fired when a new signature field has been created.
"signatureFieldDeleted" Is fired when a signature field has been deleted.
"signatureFieldDeselected" Is fired when a signature field has been deselected.
"signatureFieldSelected" Is fired when a signature field has been selected.
"spellCheckText" Is fired, if the document's text has been altered and the spelling of the new text must be checked.
"subTextPartCreated" Is fired when a subtextpart has been created.
"subTextPartDeleted" Is fired when a subtextpart has been deleted.
"subTextPartClicked" Is fired when the user clicks into a sub text part.
"subTextPartDoubleClicked" Is fired when the user double clicks into a sub text part.
"subTextPartEntered" Is fired when the input position enters a sub text part.
"subTextPartLeft" Is fired when the input position leaves a sub text part.
"tableCreated" Is fired after a new table has been created as a result of a text insertion via the clipboard or when loading a document which contains a table without an identifier.
"tableDeleted" Is fired after a table has been deleted.
"tableOfContentsCreated" Is fired when a table of contents has been created.
"tableOfContentsDeleted" Is fired when a table of contents has been deleted.
"tableOfContentsEntered" Is fired when the current input position has been moved to a position that belongs to a table of contents.
"tableOfContentsLeft" Is fired when the current input position has left a table of contents.
"textControlChanged" Obsolete. Is fired when the content of the current document has changed. Use the "changed" event instead.
"textControlLoaded" Is fired after the TextContol instance has been properly initialized and is ready to be used / manipulated programmatically.
"textDropped" Is fired when RTF text, HTML text or plain text is dragged and dropped onto the control.
"textFieldClicked" Is fired when the user clicks into a text field.
"textFieldCreated" Is fired when a text field has been created.
"textFieldDeleted" Is fired when a text field has been deleted.
"textFieldEntered" Is fired when the input position enters a text field.
"textFieldLeft" Is fired when the input position leaves a text field.
"textFrameActivated" Is fired when a text frame gets the current text input position from another part of the document such as a header, a footer or the main text.
"textFrameCreated" Is fired when a new text frame has been created.
"textFrameDeactivated" Is fired when a text frame loses the current text input position and another part of the document such as a header, a footer or the main text gets it.
"textFrameDeleted" Is fired when a text frame has been deleted.
"textFrameDeselected" Is fired when a text frame has been deselected.
"textFrameSelected" Is fired when a text frame has been selected.
"textPasted" Is fired when RTF text, HTML text or plain text is pasted into the control via Ctrl-V.
"textViewLocationChanged" Is fired when the position of the text view has changed.
"trackedChangeChanged" Is fired when the text of a tracked change has been altered.
"trackedChangeCreated" Is fired when a tracked change has been created.
"trackedChangeDeleted" Is fired when a tracked change has been deleted.
"trackedChangeStateChanged" Is fired when the state of a tracked change alters from active to inactive or vice versa.
"unhandledError" Is fired before an error will be thrown.
"webSocketClosed" Is fired if the websocket connection is closed.
"zoomFactorChanged" Is fired when the zoom factor of the text editor has changed.
callback The event listener. Depending on the event specified in parameter eventName the event listener function is called with different event argument objects (or none at all).
Event Description
"barcodeCreated" BarcodeCallback
"barcodeDeleted" BarcodeCallback
"barcodeDeselected" BarcodeCallback
"barcodeSelected" BarcodeCallback
"blur" EventCallback
"cannotTrackChange" CannotTrackChangeCallback
"changed" EventCallback
"charFormatChanged" EventCallback
"chartCreated" ChartCallback
"chartDeleted" ChartCallback
"chartDeselected" ChartCallback
"chartSelected" ChartCallback
"clipboardDataTransferAborted" ClipboardDataTransferAbortedCallback
"clipboardDataTransferComplete" ClipboardDataTransferCompleteCallback
"clipboardDataTransferProgress" ClipboardDataTransferProgressCallback
"clipboardDataTransferStart" ClipboardDataTransferStartCallback
"clipboardModeChanged" ClipboardModeChangedCallback
"commentChanged" CommentEventCallback
"commentCreated" CommentEventCallback
"commentDeleted" CommentEventCallback
"commentedTextEntered" CommentEventCallback
"commentedTextLeft" CommentEventCallback
"commentStateChanged" CommentEventCallback
"contentsReset" EventCallback
"contextMenuOpening" ContextMenuEventCallback
"documentLinkClicked" DocumentLinkCallback
"documentLoaded" DocumentLoadedCallback
"documentSizeChanged" RequestSizeCallback
"drawingActivated" DrawingCallback
"drawingCreated" DrawingCallback
"drawingDeactivated" DrawingCallback
"drawingDeleted" DrawingCallback
"drawingDeselected" DrawingCallback
"drawingSelected" DrawingCallback
"editableRegionCreated" EditableRegionCallback
"editableRegionDeleted" EditableRegionCallback
"editableRegionEntered" EditableRegionCallback
"editableRegionLeft" EditableRegionCallback
"fileDropped" FileDroppedCallback
"focus" EventCallback
"footnoteCreated" FootnoteCallback
"footnoteDeleted" FootnoteCallback
"footnoteReferenceMarkEntered" FootnoteCallback
"footnoteReferenceMarkLeft" FootnoteCallback
"footnoteSectionActivated" EventCallback
"footnoteSectionDeactivated" EventCallback
"formFieldCheckChanged" CheckFormFieldCallback
"formFieldDateChanged" DateFormFieldCallback
"formFieldSelectionChanged" SelectionFormFieldCallback
"formFieldTextChanged" TextFormFieldCallback
"frameDeselected" FrameCallback
"frameMoved" FrameCallback
"frameSelected" FrameCallback
"frameSized" FrameCallback
"headerFooterActivated" HeaderFooterCallback
"headerFooterDeactivated" HeaderFooterCallback
"hypertextLinkClicked" HypertextLinkClickedCallback
"hyphenateWord" HyphenateWordCallback
"imageCreated" ImageCallback
"imageDeleted" ImageCallback
"imageDeselected" ImageCallback
"imageSelected" ImageCallback
"inputParagraphChanged" EventCallback
"inputPositionChanged" InputPositionChangedCallback
"mainTextActivated" EventCallback
"pageFormatChanged" EventCallback
"paragraphFormatChanged" EventCallback
"removeCombobox" EventCallback
"ribbonTabLoaded" RibbonTabLoadedCallback
"ribbonTabsLoaded" RibbonTabsLoadedCallback
"ribbonTabIndexChanged" RibbonTabIndexChangedCallback
"signatureFieldCreated" SignatureFieldCallback
"signatureFieldDeleted" SignatureFieldCallback
"signatureFieldDeselected" SignatureFieldCallback
"signatureFieldSelected" SignatureFieldCallback
"spellCheckText" SpellCheckTextCallback
"subTextPartCreated" SubTextPartCallback
"subTextPartDeleted" SubTextPartCallback
"subTextPartClicked" SubTextPartCallback
"subTextPartDoubleClicked" SubTextPartCallback
"subTextPartEntered" SubTextPartCallback
"subTextPartLeft" SubTextPartCallback
"tableCreated" TableCallback
"tableDeleted" TableCallback
"tableOfContentsCreated" TableOfContentsCallback
"tableOfContentsDeleted" TableOfContentsCallback
"tableOfContentsEntered" TableOfContentsCallback
"tableOfContentsLeft" TableOfContentsCallback
"textControlChanged" TextControlChangedCallback
"textControlLoaded" TextControlLoadedCallback
"textDropped" TextDroppedCallback
"textFieldClicked" TextFieldCallback
"textFieldCreated" TextFieldCallback
"textFieldDeleted" TextFieldCallback
"textFieldEntered" TextFieldCallback
"textFieldLeft" TextFieldCallback
"textPasted" TextPastedCallback
"textFrameActivated" TextFrameCallback
"textFrameCreated" TextFrameCallback
"textFrameDeactivated" TextFrameCallback
"textFrameDeleted" TextFrameCallback
"textFrameDeselected" TextFrameCallback
"textFrameSelected" TextFrameCallback
"trackedChangeChanged" TrackedChangeCallback
"trackedChangeCreated" TrackedChangeCallback
"trackedChangeDeleted" TrackedChangeCallback
"trackedChangeStateChanged" TrackedChangeCallback
"textViewLocationChanged" TextViewLocationChangedCallback
"unhandledError" ErrorCallback
"webSocketClosed" WebSocketClosedCallback
"zoomFactorChanged" ZoomFactorChangedCallback

Examples

The following example shows how to attach an event handler to the "textFieldClicked" event.

function fieldClickedHandler(e) 
{ 
console.log("Field type: " + e.fieldType); 
console.log("Field name: " + e.fieldName); 
console.log("Merge field type: " + e.typeName); 
} 

TXTextControl.addEventListener("textFieldClicked", fieldClickedHandler); 

Possible console output after clicking into a merge field: 
> Field type: APPLICATIONFIELD 
> Field name: SalesOrderID 
> Merge field type: MERGEFIELD

Further Reading

Learn more about the Javascript: TXTextControl.addEventListener Method in the Text Control Blog: