To determine the instance of the record associated with a given subform, you can get the subform's
index property value. Since new instances are created with the same name as siblings of one another, they end-up getting index numbers in order to make them unique.
For example, if you create a new instance of the Task subform, you'll have "Task[0]" and "Task[1]" where
this.index will be 0 or 1. If it's an object parented to the Task subform which needs to know the instance of the Task subform/record in which it occurs, you can use the
parent property to drill up to the Task subform which contains the object in question and then get its index property value.
Creating bookmarks is a little more complicated. Unfortunately, XFA doesn't support bookmarks so you have two options:
- Use the xfa.host.setFocus("field name") method to set focus, when the user clicks a button, to a field somewhere on the form to have Acrobat automatically scroll the field in view and set focus to it (see post #6 of the
Links Within PDF thread for an example); or
- Use the
target property of the event object you get in an XFA event script to access the Acrobat Document object and then programmatically add bookmarks to the form (but
this will only work if the form is viewed using Acrobat):
event.target.bookmarkRoot.createChild("Next Page", "this.pageNum++");
I'm not familiar enough with creating bookmarks in Acrobat to elaborate further on the subject but you can read more about it in the
Acrobat JavaScript Scripting Reference.
I hope this helps!
Stefan
Adobe Systems