Dynamic Next Page button

zyrusc13762308

31-10-2018

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

Accepted Solutions (1)

Accepted Solutions (1)

radzmar

MVP

01-11-2018

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

Answers (4)

Answers (4)

radzmar

MVP

28-12-2018

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

zyrusc13762308

27-12-2018

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.