I am losing my mind here! There's got to be a way to do this:
Trying to restrict the total number of pages in a dynamic form with a repeating subform.
I cannot for the life of me get the presence of these subforms to work! I'm not sure if I put code on the PageCount item on master page #2, or on the subform1 and subform2...
Here's what I was trying:
if (xfa.layout.pageCount>3){
Page1.subform1.SubmitButton1.presence = "hidden";
Page1.subform2.SubmitButton2.presence = "visible";
} else {
Page1.subform1.SubmitButton1.presence = "visible";
Page1.subform2.SubmitButton2.presence = "hidden";
}
Where am I going wrong? Thanks for any help you can provide!
Solved! Go to Solution.
Views
Replies
Total Likes
I figured it out! Here was the solution:
I wrapped my two buttons (Submit and fake submit) in a subform called "buttons". (Without wrapping them in the subform the functionality still worked but the buttons ended up at the top of page 1 instead of at the end of the form.)
Then I put this Javascript in the layout:ready event of SubmitButton1 (the real submit button):
if (xfa.layout.pageCount()>3) {
Page1.buttons.SubmitButton1.presence = "hidden";
}
else {
Page1.buttons.SubmitButton1.presence = "visible";
}
And I put this Javascript in the layout:ready event of SubmitButton2 (the fake submit button):
if (xfa.layout.pageCount()>3) {
Page1.buttons.SubmitButton2.presence = "visible";
}
else {
Page1.buttons.SubmitButton2.presence = "hidden";
}
The presence of both buttons is set to "Hidden" in the Object - Field tab.
On the click event of SubmitButton2 I have this JavaScript:
xfa.host.messageBox("Per the instructions on page 1 of this form, this document must be no longer than 3 pages. Please delete some text from the document before you submit it so that it is 3 pages or less or else it will be rejected."
, "Exceeded Allowed Number of Pages", 1);Views
Replies
Total Likes
I figured it out! Here was the solution:
I wrapped my two buttons (Submit and fake submit) in a subform called "buttons". (Without wrapping them in the subform the functionality still worked but the buttons ended up at the top of page 1 instead of at the end of the form.)
Then I put this Javascript in the layout:ready event of SubmitButton1 (the real submit button):
if (xfa.layout.pageCount()>3) {
Page1.buttons.SubmitButton1.presence = "hidden";
}
else {
Page1.buttons.SubmitButton1.presence = "visible";
}
And I put this Javascript in the layout:ready event of SubmitButton2 (the fake submit button):
if (xfa.layout.pageCount()>3) {
Page1.buttons.SubmitButton2.presence = "visible";
}
else {
Page1.buttons.SubmitButton2.presence = "hidden";
}
The presence of both buttons is set to "Hidden" in the Object - Field tab.
On the click event of SubmitButton2 I have this JavaScript:
xfa.host.messageBox("Per the instructions on page 1 of this form, this document must be no longer than 3 pages. Please delete some text from the document before you submit it so that it is 3 pages or less or else it will be rejected."
, "Exceeded Allowed Number of Pages", 1);Views
Replies
Total Likes