Expand my Community achievements bar.

Insert PDF Attachment, Open Attachment and Remove Attachment issues. Please help

Avatar

Level 2

Hello all,

I'm in the middle of creating a very complex pdf form via LC and have run into a couple of roadblocks. On page 5, I need the user to be able to attach a document "Add Profile", they then need to be able to open the attachment "View Profile" and remove the document if needed "Remove Profile. My Add Profile button works great but the View and Remove can't locate the file attachment.


Here is a link to my working document: http://adobe.ly/1B5Xhen

Here is a link to the document I am using as a code reference: http://adobe.ly/1C1hlJE


My button scripts are Below:

form1.Successor_Summary.Table2.Row1.Table3[1].Row1.Cell1.Add_Profile::click - (JavaScript, client)

var myDoc = event.target;

var sFile = "myFile".rawValue;

myDoc.importDataObject({cName: sFile});

var myDataObject = myDoc.getDataObject(sFile);

var sFileName = myDataObject.path;

Profile_Name.rawValue= sFileName,sFile;



form1.Successor_Summary.Table2.Row1.Table3[1].Row1.Cell1.Remove_Profile::click - (JavaScript, client)

try{

var myDoc = event.target;

var sFile = ProfileName.rawValue;

app.alert(sFile);

myDoc.removeDataObject(sFile);

ProfileName.rawValue= "";

/*

var myRemoveObject = event.target;

var a = myRemoveObject.getField("form1.Successor_Summary.Table2.Row1.Table3.Row1.Cell1.ProfileName");

a.deleteItemAt(); // delete current item, and...

a.currentValueIndices = 0;

*/

catch(e)

{

app.alert("Error in removing document");

}

xfa.layout.relayout();

form1.Successor_Summary.Table2.Row1.Table3[1].Row1.Cell1.ViewProfile.View_Profile::click - (JavaScript, client)

try{

var myDoc = event.target;

var sFile = Profile_Name.rawValue;


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

}

catch(e)

{

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

}

0 Replies