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.
Actually, the duplicate field name thing is intentional. I want the value to be copied throughout the newly created file.
My question is regarding the java, not the duplicate fields--unless you think the duplicate fields is causing the java problem, of course.
I didn't realize it was. I didn't put it in the "custom calculation script" section. I put it in the "document" level under "document actions". Is this not different?
Which document action?
There is a "Document" scripts wiith Acrobat Professional and when a script is located there, the script apples to all pages and actions within the PDF and for any code that is subject to reuse or used to initialize the form.