Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Page Navigation

Not applicable
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?
9 Replies
Steve_L_Walker
Level 10
Level 10
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
jashachik
Level 2
Level 2

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?

Niall_O_Donovan
Level 10
Level 10
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
DrDave6
Level 3
Level 3

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.

Niall_O_Donovan
Level 10
Level 10

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.

DrDave6
Level 3
Level 3

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?"

Niall_O_Donovan
Level 10
Level 10

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

DrDave6
Level 3
Level 3

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.

Not applicable
Thank you! I adjusted the XML code and am now able to navigate at will.



Regards.