I have several forms I combine into a single PDF. Several form fields are identical in each file. I use Javascript to populate some of the data such as the current Date and Current Time.
After combining the files, however, the javascript is completely gone.
Here's what I use:
getField("DateToday").value = util.printd("mm/dd/yyyy", new Date())
getField("TimeNow").value = util.printd("h:MM tt", new Date())
I have it placed in the "Document will Print" section under "Documenet Actions".
Where do I put my code so that it doesn't get wiped out when i combine the files?
If you look closer, you will see more than your code being lost.
Form fields with the same name share many common properties. The more important of which for a text field is the value of the field. That means if there are more than one text field with the same name, the value of any one of the fields with the same name will have the same value.
With Acrobat forms, if you want to have multiple copies of the same form within one PDF you need to have each field uniquely named. Usually many will prefix the field name with the value "p" + the zero based page number. You will have to adjust all your scripts to adjust for this prefix.
North America
Europe, Middle East and Africa
Asia Pacific