Javascript doesnt run from Button action
Hi everybody,
I have the feeling my problem should be simple to solve but I cant figure it out. I am very new to this .. so I might be absolutley on the wrong track.
I have two PDF forms: A0.pdf and A1.pdf. The user should fill the template A0.pdf and if required afterwards also the additional template A1.pdf. As there are form fields containing the same information in both forms, I would like to transfer the mutual data from the A0.pdf to the A1.pdf . My idea was to use a button in the A0.pdf that if pressed opens an empty template of the A1.pdf and then fills in the data. Here is what I came up with so far as an example for one Name field:
var v = this.getField("A0-Name1");
var myDoc = app.openDoc({cPath: "/C/UserData/user/Documents/A1-template.pdf", bHidden: false});
myDoc.getField("A1-Name1").value = v.value;
The script works when I run it from the console. But when I trigger it trough the action of my button the following error is returned:
TypeError: myDoc is undefined
3:AcroForm:A1button:Annot1:MouseUp:Action1
can anyone help or has a different solution to my problem?
Thank you very much 🙂
Tullius
