Adding multiple buttons to attach files

willp512 23-09-2016

I created a form and I have multiple buttons that say "Attach" and when clicked will allow a user to attach a file to the PDF. The file name then shows up in the text field next to it. I am running into a problem though. When I attach a file using button1 it will work. Button2 will attach another file and it shows up in the attachments ... but when I save and close it and reopen it, only the last file I attached is saved in attachments. Is it because I used the same JavaScript for all my buttons (besides changing the TextField name?? Here is the script I used:

var myDoc =;

var sFile;


var myDataObject = myDoc.getDataObject(sFile);

TextField10.rawValue = myDataObject.path;

ANY help would be great. I'd like to have button1 attach a file, button2 attach a different file, etc. And they all be saved and available when reopened.

Mark Solution

Are these answers useful?
Help other community members by marking useful answers as accepted.

Accepted Solutions (0)