PDF Form Javascript for numbering pages from a template
I have a two page form. Page 2 has a "Add Page" button on it that generates a copy of it from a template.
On this replicating page I have two page number fields the left is the current page number and the right is the total replicated pages. The number starts at 1.
I'm running into a problem with the additional pages. When generating page the second replicated page it the last page says 2, as it should. But when I continue generating pages the third generation then says -1 and updates to 3 when I add the 4th but then the 4th is -1 until I add the 5th and so on.
My script in this field is :
event.target.value = event.target.page;
if(event.target.value == "-1"){
this.calculateNow();}
What am I missing? please help!