On my template page, I have a field that is a "Page __ of __" field that should auto-populate when the user creates a new template page. The 1st 6 pages of my 12 page file are intro information, and then page 7 is where the first 'add a page' button is, which calls forth the "T1 template", which spawns as page 8. Yet both of these pages have the Page blank of blank.
So to illustrate, page 7 starts with Page 1 of 1. When the user hits the 'add a page' and generates page 8, page 7 should be Page 1 of 2, and page 8 should be Page 2 of 2. Then when they hit the button again on the newest page, page 7 should be Page 1 of 3, page 8 should be Page 2 of 3, and page 9 should be Page 3 of 3, and etc etc.
So the code I have so far for the "add a page" button on page 7 (and this one seems to be working fine as it's a specific increment with non-changing field names) is:
var f1 = this.getField(prefix + "meta-pagecount1");
var f3 = this.getField("Page Number of Number 2").value = pageNum-5;
var f2 = this.getField(prefix + "meta-pagecount2").value = f3;
event.target.display = display.hidden;
As if that wasn't enough, there is also a second section of the pdf (on page 10) that also has the "Page blank of blank", which is totally independent of the first, but that prohibits the ability to simply do a page count from the total number of pages in the document (for part 1) since there is no way to know how many pages the user might create from the second template for part 2. Right now though, I'm only trying to get part 1 working, and I have page 7 working correctly so far, but incorrect numbers are generating upon spawning on the subsequent pages.