I have a number of multi page forms where I would like to include the following buttons in the header on the Master page. I have two Master pages one for page 1 and the second one for all remaining pages. It looks like this:
Ignore the blue lines, please, they are guides in the master page. Notice the arrowhead buttons on the right side. I've used the following scripts to make the buttons work. I used a very small textfield as the focus point at the top of each page now on the Master Page 2:
Double Left arrow heads button has this script: xfa.host.setFocus(form1.page1.TextField1);
Single left arrow head button has this script: xfa.host.pageUp();
Single right arrow head button has this script: xfa.host.pageDown();
Double right arrow heads button has this script: xfa.host.setFocus (form1.page5.TextField1); I edit this button depending on the last page in the form.
Before I put this at the top of each page. Then I decided to put the buttons (and the whole header) on Master Page 2 (saves time and formatting each page). All buttons work fine except the right double arrow head (go to last page). I understand why it's not working, but I don't know how to fix it. I'd welcome any help available.
I would first recommend the built-in Page Navigation custom object. It does almost exactly what you've specified you want your buttons to do. The major difference being that it doesn't set the focus on TextField1.
Second, are you repeating the same page so that you know for sure the field is named TextField1? When I was putting together an example to test, as I added one text field to each page, and the number incremented up each time I added a new field on a new page.
So when I changed the code you provided to match, it worked for me on both sets of master pages. Pages 1-2 are on Master Page 1, and Pages 3-4 are on Master Page 2.