another page number question...

Avatar

13-01-2009

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

Replies

Avatar

13-01-2009

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

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

14-01-2009

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.

Avatar

14-01-2009

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

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

14-01-2009

If you put it on the calculate event then each time the form is layed out that script will run.

Avatar

14-01-2009

Would you be willing to take a look at my file & see what I'm doing wrong?



jamie.myer@acmartin.com

Avatar

Avatar

pguerett

Avatar

pguerett

pguerett

14-01-2009

Send the file and a synopsis of th eissue to livecycle8@gmail.com and I will have a look when I get a chance