My form has a repeatable subform that contains both a scripted button for adding attachments and a list box (titled "attachedfile") which displays the attached files. As the subform is repeated there are more buttons and from which I can add more attachments to their respective list boxes. The script appears to work like a charm, but if I manually try to view the attachments I'm only able to see the last one. When I save the PDF, the file names in the list boxes disappear and I'm only able to open the last file I attached. Here's the script for my attach button, hopefully someone can point out my problem.
var
myDoc = event.target;
var
sFile = "myFile"
myDoc.importDataObject({cName
: sFile});
var
myDataObject = myDoc.getDataObject(sFile);
var
sFileName = myDataObject.path;
sub9.Table20.Row1.attachedfile.addItem(sFileName
, sFile);
-gollum
Solved! Go to Solution.
Views
Replies
Total Likes
Preserve scripting changes isn't turned on.
File->Properties->Defaults->Scripting - set "Preserve scripting changes to form when saved" to Automatically.
Views
Replies
Total Likes
Hmm... It has nothing to do with being repeatable because even if I only have one field for adding attachments, upon saving the file, closing it, then opening it again, only 1 attachment is present; the most recently attached file. The others disappear. Why?
-gollum
Views
Replies
Total Likes
Have you seen Paul's sample?
Views
Replies
Total Likes
Yes, that's the file I used to figure out how to do this scripting in the first place. I just tested the sample and found that although it doesn't have the problem of losing attachments after the file has been saved and reopened, they no longer appear in the list box. It looks like I'm dealing with two issues here. Could you explain to me why Paul's sample doesn't keep the attachments in the list box when it's saved and reopened? Thanks.
-gollum
Views
Replies
Total Likes
Preserve scripting changes isn't turned on.
File->Properties->Defaults->Scripting - set "Preserve scripting changes to form when saved" to Automatically.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies