Hi,
You can also script buttons to go directly to a set page. You will see similar script if you drag a print button into your form and look at the script in the click event:
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);
The second parameter in the brackets "0" says that you want to print from page 1 (the numbering of pages is zero based, so page 1 is referenced zero). The next parameter is "xfa.host.numPages -1" this says that you want to print up to and including the last page. xfa.host.numPages counts the number of pages and then the -1 turns that number into the zero based system. Bear this in mind when setting up your page navigation script.
In addition to the next page and previous page buttons above, you can srcipt buttons to jump to specific pages. This is easier if the pages within the form do not grow /spawn into new pages, for example as the user fills in data the form grows from 3 pages to 5 pages in length.
Lets say the form is 4 pages long and has a front page and 3 individual forms that the user could fill in. You would set up three buttons on the master page as above and put the single line of javascript in the click event of each button:
xfa.host.currentPage = xfa.host.numPages -3; // this will jump to page 2
xfa.host.currentPage = xfa.host.numPages -2; // this will jump to page 3
xfa.host.currentPage = xfa.host.numPages -1; // this will jump to page 4 (the last page)
Another option would be to set the presence of the optional pages to hidden. For the four page example above, number your page p1, p2, p3, p4. Leave the precence of p1 visible. When you set p2, p3, p4 to hidden, they are excluded from the layout. In the master page only have three buttons (still called something like go to Form 1, go to Form 2, etc.). Then in the click event of the first one have the following javascript:
form1.p2.presence = "visible";
form1.p3.presence = "hidden";
form1.p4.presence = "hidden";
The script to shouw page 3 and hide the others is:
form1.p2.presence = "hidden";
form1.p3.presence = "visible";
form1.p4.presence = "hidden";
Lastly the show page 4 and hide the other:
form1.p2.presence = "hidden";
form1.p3.presence = "hidden";
form1.p4.presence = "visible";
Using this method means that you have turned a multiple page form into a two page form and are only presenting the pages that the user needs to see based on their (clicking) choice on page 1.
Hope that helps,
Niall