Forms
You can programmatically trigger actions synchronized with user input in document form fields. You only need to subscribe to the corresponding UI event using instance#addEventListener, and the callback you provide will be called whenever the event takes place:
instance.addEventListener("annotations.focus", function (annotationFocusEvent) { // Will log the properties of the widget annotation that was just focused. console.log(annotationFocusEvent.annotation.toJS());});Other events that can be used to detect user input in form fields besides "annotations.focus" are "annotations.blur" and "annotations.press".
For a complete list of events available for subscription, you can check out the API documentation entry for instance#addEventListener.