Multiple Attachment Boxes

Avatar

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)

Avatar

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

Avatar

Avatar

radzmar

MVP

Avatar

radzmar

MVP

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?

Avatar

29-05-2015

The closing bracket was missing off the screen shot - but the code works perfectly for one attachment box

Avatar

Avatar

christopherf635

Avatar

christopherf635

christopherf635

27-05-2015

sp215,

Is this the complete code?  It doesn't look syntactically correct (no closing bracket.)  Have you used the syntax/error checker?