Multiple Attachment Boxes

sp215

22-05-2015

Multiple Attachments.PNG

I have created a sample form with 3 attachment boxes in, they all add attachments fine, but when I open the first attachment in box 1 that opens fine, but when I try to open the attachment in Box 2 it will only open the attachment in Box 1

Code to Open Attachment is:-

try{

var myDoc = event.target;

var sFile = ListBox1.rawValue;

 

myDoc.exportDataObject({ cName: sFile, nLaunch: 2 });

 

catch(e)

Any help would be appreciated

Accepted Solutions (0)

Answers (4)

Answers (4)

sp215

01-06-2015

Hi,

This is the script for the adding and opening of the listboxes.

 

Add attachment – Listbox1

 

var myDoc = event.target;

 

var sFile = "myFile" + NumericField1.rawValue;

 

  1. myDoc.importDataObject({cName: sFile});

 

var myDataObject = myDoc.getDataObject(sFile);

 

var sFileName = myDataObject.path;

 

ListBox1.addItem(sFileName,sFile);

 

NumericField1.rawValue = NumericeField1.rawValue + 1;

 

 

Add attachment – Listbox2

 

var myDoc = event.target;

 

var sFile = "myFile" + NumericField2.rawValue;

 

  1. myDoc.importDataObject({cName: sFile});

 

var myDataObject = myDoc.getDataObject(sFile);

 

var sFileName = myDataObject.path;

 

ListBox2.addItem(sFileName,sFile);

 

NumericField2.rawValue = NumericeField2.rawValue + 1;

 

 

Open attachment – Listbox1

 

try{

 

var myDoc = event.target;

 

var sFile = ListBox1.rawValue;

 

myDoc1.exportDataObject({ cName: sFile, nLaunch: 2 });

 

}

 

catch(e)

 

{

 

  1. app.alert("There are no files to open");

 

}

 

 

Open attachment – Listbox2

 

try{

 

var myDoc = event.target;

 

var sFile = ListBox2.rawValue;

 

  1. myDoc.exportDataObject({ cName: sFile, nLaunch: 2 });

 

}

 

catch(e)

 

{

 

  1. app.alert("There are no files to open");

 

}

 

I need to find a way of clearing the list box before opening as it is retaining the 'last' opened document regardless of which listbox it was from

Thanks

radzmar

MVP

30-05-2015

Do you use the same script for all 3 Lists?

You may accidenty use var sFile = ListBox1.rawValue; for all of them! have you checked this?