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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Dynamic Next Page button

zyrusc13762308
Level 3
Level 3

I have a form with "Previous" and "Next" page buttons on a second master page. I was wondering if it were possible to script the Next Page button so that it detects what page it is on and if it is the last page of the form, to hide it. The bottom of the form has buttons for Save, Print, and Email, so I don't want any buttons appearing below that.

Can this be done?

I thought about just creating a third master page with only the Previous Page button on it, but then though that maybe I could save a few bytes and make the Next Page button more functional.

I appreciate your help!

Thanks

1 Accepted Solution
radzmar
Correct answer by
Level 10
Level 10

This is quite easy to accomplish:

This script comes into the click event …

// Goto next page

xfa.host.currentPage = xfa.layout.absPage(this) + 1;

… and this into the layout ready event.

// Hide the button on the last page

this.presence = (xfa.layout.absPage(this) + 1) < xfa.layout.absPageCount() ? "visible" : "hidden";

View solution in original post

5 Replies
radzmar
Correct answer by
Level 10
Level 10

This is quite easy to accomplish:

This script comes into the click event …

// Goto next page

xfa.host.currentPage = xfa.layout.absPage(this) + 1;

… and this into the layout ready event.

// Hide the button on the last page

this.presence = (xfa.layout.absPage(this) + 1) < xfa.layout.absPageCount() ? "visible" : "hidden";

View solution in original post

zyrusc13762308
Level 3
Level 3

radzmar​, thanks again for this code snippet. Definitely came in handy.

How can I modify it for a Reset button? I have a form with a Reset button on the Master page but I only want the button to show on the first page.

I appreciate your help.

radzmar
Level 10
Level 10

To show the button only on the fist age use this script:

// Hide the button on every page except the first

this.presence = (xfa.layout.absPage(this) + 1) === 1 ? "visible" : "hidden";

Or alternatively:

// Hide the button on every page except the first

this.presence = xfa.layout.absPage(this) === 0 ? "visible" : "hidden";