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.
- The "Restrict Page Occurrence" option on the Master Page object tab does not work properly because of the repeating subform in the form.
- I have two master pages. MasterPage1 is the first page of the document and MasterPage2 is pages 2+.
- The form starts off as 1 page and if the user creates a few instances of the repeating subform, it'll automatically flow onto master page #2.
- I created two buttons at the end of the form, each within their own subforms.
- subform1.SubmitButton1 the actual Submit button and its presence should be "visible" if the total document page count is equal to or less than 3.
- subform2.SubmitButton2 is a fake submit button set up with an error message on its click event and its presence should be set to "visible" if the total document page count is greater than 3 (it should be hidden otherwise).
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!