How can I get a page number to change once a narrative section has been started?

I have a 3 page form and I would like for the page number on the first page to change to 2 from 1 in someone starts writing on the 2nd page and the same thing to happen to all 3 page if someone starts typing on page 3.


qwerty qwerty


5 Answers

Open the Pages panel. From the options menu, select Number Pages which opens the Page Numbering dialog.


David Austin   

No, I dont think that that it will work. There are 3 pages. The first says 1 of 1. I need it to change to 2 if the forms detects typing on page 2 and to a 3 if it detects typing on page 3.


qwerty qwerty   

"How do I do that?"

Scrub of page numbers that are in the running text (PDF page content). Forms' running text isn't created with Acrobat. Some other application, such as MS Word, is used. Scrub out page numbering there. Output a new PDF. Using a working copy of the original PDF having form fields use Acrobat's "Replace" to replace the page(s) with the PDF having no page numbers. This leaves the form fields alone; although you may have to tweak field placement.

Javascript — Several scripting wizards frequently contribute. One may drop by.


David Austin   

One thing you have to be aware of; it may be relevant, or not for this specific case, but nevertheless think about it. What you proveide the user to fill out is a three-page form. This three-page form is your standard form. If only one page of the form is filled, it is something depending on the particular case, but even then, your standard form is the three-page form. If only one page of this three-page form is submitted, the submitted form is no longer the standard form. You don't know whether pages got missing, or were not filled out intentially, or what.

That said, you could do something like this, assuming that your "important" fields exist only once in the form (if you have to take care of multiple occurrances, it is possible, but you'd have to adjust the code accordingly; see pages property of the Field Object in the Acrobat JavaScript documentation. Also, the field for the pagenumber shall be named "pagenbr.0" on the first page, pagenbr.1 on the second page, and pagenbr.2 on the third page:

a) In a little document-level script, you define a variable "maxpag":

var maxpag = 0 ;

b) In the Validate event of each of the relevant fields you add this line of code:

maxpag = Math.max(maxpag, event.target.pages) ;

c) add a small text field; name does not matter, read-only and hidden to which you assign the following Calculate script:

for (var pnr = 0 ; pnr < 3 ; pnr++) {
this.getField("pagenbr." + pnr).value = (pnr+1) + " of " + maxpag ;
}

And that should do it. However, note that if you clear all fields on a subsequent page, this code will not change the page number fields.

Hope this can help.




Max Wyss   

Baisically on my page I have 3 narrative secitons named as "narrative_1", "narrative_2", and "narrative_3". I would like my count field named "page_of" which I would like to change to a "1", "2", or "3" based on if the narrative sections are filled out. For example if "narrative_1" is filled out "page_of" will reflect a "1". If "narrative_1" and "narrative_2" are filled out it will reflect a "2" and if all 3 sections are filled out it will reflect as a "3". Any ideas?


qwerty qwerty   


Please specify a reason: