Highlighted

Page Navigation

Avatar

Guest

13-02-2009

I am trying to insert page navigation buttons that will go to specific pages in my form. I thought this would as easy as inserting hyperlinks, but this doesn't seem to be an option in ALC.



I have an eight page form and want them to be able to jump to various pages. Can someone please advise me how to do this?

Replies

Highlighted

Steve_L_Walker

13-02-2009

Cristy,



Consider the use of bookmarks.



For navigation buttons you are limited to serially paging through the form using xfa.host.pageUp() and xfa.host.pageDown() on a button click event.



Steve
Highlighted

Niall_O_Donovan

14-02-2009

Hi Cristy,



I have a button that jumps the user to the last page of a 10 page form. The following Javascript is in the click event:



xfa.host.currentPage = xfa.host.numPages - 1;



I presume that if you had something similar and changed the subtracted value you could have your navigation buttons.



Good luck,



Niall
Highlighted

DrDave6

16-04-2009

I have put two buttons in my form ("Previous Page" and "Next Page").

For the "Next Page" button I want to say, if I'm on the last-page, goto page-1,   else xfa.host.pageDown().

For the "Previous Page" button I was to say, if I'm on the first-page, goto the last pge, else xfa.host.pageUp()

What does the java script look like for these two buttons? As you can see, I'm new at this! 🙂

Thank you for your help.

Highlighted

Niall_O_Donovan

16-04-2009

Hi,

You can script this, but I wonder is it a good thing for a user to click page up on page 1 and end up at the last page. Similarly for the last page. It might confuse.

Anyway, page up on page 1 could look like:


if (xfa.host.currentPage == 0)

{

     xfa.host.currentPage = xfa.host.numPages - 1;

}

else

{
    xfa.host.pageUp()

}

The page down on the last page could look like this:

if (xfa.host.currentPage == xfa.host.numPages - 1)

{

     xfa.host.currentPage = 0;

}

else

{
     xfa.host.pageDown()

}

I will be honest, I think that I would delete the "Page Up" button on page 1 and the "Page Down" button off  the last page...

N.

Highlighted

DrDave6

16-04-2009

Thank you for your insight here, I see what you mean.

Would I, for example on the "Next Page" button, say "if on the last page, then make the button invisible?"

Highlighted

Niall_O_Donovan

16-04-2009

Hi,

If the buttons on are the individual pages, then I would just delete the appropriate ones on the first and last pages.

If the buttons are on the master page, then I don't think that you can change the presence of the buttons based on the page number the user is currently viewing.

You can change what the button does, for example:

if (xfa.host.currentPage == xfa.host.numPages - 1)
{
    app.alert("You are already on the last page");
}
else
{
     xfa.host.pageDown();
}

Hope that helps,

Niall

Highlighted

DrDave6

16-04-2009

My buttons are on the Master Page and you are correct, you cannot set the presence if that is the case as I tried this.

Thanks for your help, the matter is resolved now.

Highlighted

jashachik

21-11-2013

I am successfully using xfa.host.currentPage = 2; for navigation on a PDF but for HTML it does not work, can you provide the logic to make this work just like the PDF?