Hello,
I'm sure this is a pretty standard problem. I have a form that flows over multiple pages (in reality is just one page). I've been able to manipulate the first "Previous" button because of an if/then referencing .currentPage = "0" but since my form can have different numbers of pages I can't have a static if-then formula like that.
My first idea was something like this:
if (xfa.host.currentPage == xfa.host.numPages - 1) {
this.presence = "invisible";
}
else {this.presence = "visible";
}
But this only works on the click event of the Ok button. Of course that's not helpful. Any tips for getting this to work in the initialize event?
Is the only solution having a separate Master Page for the final page? I don't want to go down that route if possible.
Thanks for any help! I'll continue messing around with it.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
I was scripting on the fly, but have tested in Designer now. You can achieve what you want using the index of the Master page.
So this for the Previous button in the docReady event:
if (this.parent.index == 0) {
this.presence = "invisible";
}
else {
this.presence = "visible";
}
And this for the Next button in the layout:ready event:
var oPage = xfa.layout.pageCount() - 1;
if (this.parent.index == oPage) {
this.presence = "invisible";
}
else {
this.presence = "visible";
}
Hope that helps,
Niall
Views
Replies
Total Likes
I don't think you can script the presence on a master page like that.
See:
Views
Replies
Total Likes
Hi,
Having a Master Page for the final page is probably the most efficient. You can achieve it with script, but in the Layout:ready event which is not efficient as this event fires so often. See here: http://assure.ly/nB0Bvz.
Firstly for the Previous button place the script in the docReady event as this only fires once when the form is first rendered. This will work where the first page is always the first page at runttime. You can shorten the script (the if statement):
if (xfa.host.currentPage == "0") {
this.presence = "invisible";
}
else {
this.presence = "visible";
}
For the Next button on the last page you will need to use the layout:ready event:
var oPage = xfa.layout.pageCount() - 1;
if (xfa.host.currentPage == oPage) {
this.presence = "invisible";
}
else {
this.presence = "visible";
}
Hope that helps,
Niall
Yikes, I hope that I haven't contradicted myself ;-)
Views
Replies
Total Likes
Thanks for the code, Niall, but it doesn't seem to work. I copied/pasted it in an almost blank form that has 3 pages. If I can figure out how to upload the example pdf I will.
I suspect it has something to do with .layout never coming up as an option (even in the layout:ready event). As you can see from the screenshot of the blank form, it's not an option. In any case, the form is getting so long that I want to keep a single Master Page so as to not clutter up the heirarchy pallette any more.
Views
Replies
Total Likes
Jono,
I'm hoping that it's possible. I can get the Master Page buttons to do different things once clicked based on where the user is in the form, but not before the user sees the button.
I may have to change up my Master Page structure and have that last page refer to its own Master Page (which conveniently won't have a Next button).
Views
Replies
Total Likes
Hi,
I was scripting on the fly, but have tested in Designer now. You can achieve what you want using the index of the Master page.
So this for the Previous button in the docReady event:
if (this.parent.index == 0) {
this.presence = "invisible";
}
else {
this.presence = "visible";
}
And this for the Next button in the layout:ready event:
var oPage = xfa.layout.pageCount() - 1;
if (this.parent.index == oPage) {
this.presence = "invisible";
}
else {
this.presence = "visible";
}
Hope that helps,
Niall
Views
Replies
Total Likes
It works like a charm. Thanks so much!
Views
Replies
Total Likes
Nice find Niall!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies