Expand my Community achievements bar.

SOLVED

Dynamic Next Page button

Avatar

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

Avatar

Correct answer by
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

Avatar

Correct answer by
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";

Avatar

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.

Avatar

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