These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

TOC and repeating subform

EBrock
Registered: Dec 28 2010
Posts: 1

I want to create a TOC in a subform that displays the content and page location of a text field contained in another subform.
 
The text field and its subform are pagination to appear on the top of the next page and also repeats when a button is selected (resulting in a new instance of the subform). So this subform can be repeated numerous times… each on a different page.
 
I am looking to create a TOC that will provided the reader with a list of the results of the text field and page location where they can find it (the subform).
 
Any ideas?
 

DaveyB
Registered: Dec 10 2010
Posts: 70
Back to the "quick and dirty" methods, but this should work! (crosses fingers, hasn't tested this one!)

There is no auto-generated TOC for PDF per se, so a dynamic form which can create subforms on the fly is going to have problems ~ a workaround based on javascript might help here.

Assuming that each subform iteration has a distinct title, which would become the title of the link in the TOC, sneak in a hidden field right next to it to contain the "CurrentPage" for that title, lets call this one nCPage. Another hidden field alongside that is a concatenation of the first two fields, with appropriate formatting, ready to display in the TOC, ie: " My Current Subform ............................. 12" (this is on page 12).

This is where we get sneaky! That last hidden field is renamed automatically by a change in nCPage, for example to tTOCx where the x on the end is an integer containing the page number - might want to pad it with zeros to allow for all possible entries! We now have a field in the subform that is named on the basis of the page on which it appears - give it global scope to avoid complications of specifying the form which contains it.

At the very end of the form, include a hidden field to contain the "PageCount", and set the on-change script to write the TOC (a simple table, set to flow onto successive pages if needed) at the top of the form. Writing the TOC now consists of an iteration of x through PageCount, check to see if the field tTOCx exists, write the field into the TOC, programatically parse the page number from the string and update the invisible button over the field to send the reader to that page.

The downside to this is that writing the TOC this way may increment the page count, which means that the function may have to reformat the document twice to get it right, but that would be automatically done since the final "PageCount" field will change again as soon as the TOC spills over onto a new page. Since the calculation is done from top to bottom of the form (I believe), then 2 recalculations should take care of it!

As I said up front, I haven't tested this, so at this point it's just a theory, and I hope it makes sense :)

DaveyB

LiveCycle Designer 8.0
"Genius is one percent inspiration, ninety-nine percent perspiration." ~~ Thomas Edison
"If at first you don't succeed, get a bigger hammer." ~~ Alan Lewis
"If the conventional doesn't work, try the unconventional" ~~ DaveyB