Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

another page number question...

Not applicable
Hi (probably Paul again!),



Getting the page number in a form seems pretty straightforward if you use the handy prefab button. I'm working on a general office form, and the assumption is that the actual print copy will have more pages stapled to it (like for a fax).



I'd therefore like the option to add some page number padding to the xfa.host.numPages.



Trying this:

var numPages = 1;

var xtraPages = 0;

numPages.value = xfa.host.numPages;

this.rawValue = parseInt(numPages.value)+ parseInt(xtraPages.value);



when I app.alert it, it seems that the xfa.host.numPages isnt going into the numPages variable. Is there a trick to accessing the info in the xfa stuff?



thanks,

-jamie
7 Replies
Not applicable
well, i realized that once again I'm asking the wrong question... dont need 2 variables, can just add xtraPages to xfa.host.numPages and get the same effect.



I'm still having trouble working with the xtraPages variable though. I've tried initializing it in the Form Properties Variables tab, but I cant get it to increment with ++xtraPages. Is there a trick to initializing it as an integer (though I though Javascript was supposed to be agnostic on this stuff??)



thanks,

-jamie
pguerett
Level 10
Level 10
The variable needs to be referenced on its own. You do not need the .value afterwards. So it should be:



numPages = xfa.host.numPages



You can validate that the call is working by doing:



app.alert(xfa.host.numPages)



If that returns what you expect, then do:



app.alert(numPages)



This assumes that you are coding javascript.
Not applicable
thanks Paul.

that's making progress finally.



Do you have any further thoughts on where to keep the

numPages = xfa.host.numPages variable updated? I'm not getting it to recalculate with other events (like when the content flows to another page). I've tried it on layout:ready, calculate & form:ready. None of them are updating automatically, but if I tickle a different button on the form it will update to the correct value.



Oh, and the buttons that add fields which cause another page to be added to have the xfa.form.recalculate(1) set currently.



thanks again.



-jamie
pguerett
Level 10
Level 10
If you put it on the calculate event then each time the form is layed out that script will run.
Not applicable
yes, that's where it is... maybe its a 'feature' 😉
Not applicable
Would you be willing to take a look at my file & see what I'm doing wrong?



jamie.myer@acmartin.com
pguerett
Level 10
Level 10
Send the file and a synopsis of th eissue to livecycle8@gmail.com and I will have a look when I get a chance