Copy link to clipboard
Copied
Hi I would like to add the total pages into a form field as it can be variable. I can see that I could do this in a header but that is not the position wanted for this data on our form. Is their a short javascript that would add this and input it in a certain form field? Thanks
Copy link to clipboard
Copied
Yes, you can use this code to do it (as a doc-level script):
this.getField("pages").value = this.numPages;
Copy link to clipboard
Copied
Hi I don't get an error but also no figure is displayed in the field. Should I add anything else?
Copy link to clipboard
Copied
Remove the function definition.
Copy link to clipboard
Copied
I read a little more and found by combining your suggestion with another if I put this in calculate field box it worked:
event.value=this.numpages
Thanks for your help
Copy link to clipboard
Copied
First of all it's numPages, not numpages. Also, if you do it like that it won't update after you remove or add pages and then re-open the file...
Copy link to clipboard
Copied
Thanks in this case that is OK. I saw the typo but you can't edit posts unfortunately once added. I'm just posting this for me as a second point that to add a date this works:
event.value=util.printd("mm/d/yyyy", new Date());