Attachment is not opening in client's end

jahantech

08-09-2018

Hi

I have made a static XFA form using livecycle designer ES4. In this form open button is not working in client's end. No file is opening after selecting from listbox although it is present in navigation panel. I can open the attachment by clicking open button in Acrobat pro dc but same thing is not happening in client's end (tried with both Acrobat pro XI & Pro DC).

I am using below code:

//In add button:

form1.page2.AddAttachment::click - (JavaScript, client)

var oObj = event.target;

var fileAttachments = oObj.dataObjects;//dataObjects returns all dataObjects(attachments)in the pdf

if(attachmentsList.length > 0)

{

oObj.importDataObject(fileAttachments.length);

var oDataObj = oObj.getDataObject(fileAttachments.length);

attachmentsList.addItem(oDataObj.path);

console.println("The attachments size is...."+fileAttachments.length);

NoOfAttachments.formattedValue = fileAttachments.length+1;

}

else

{

//we need to associate each file attachment  imported into the document with a key

//then get the file attachment's name and add it to the drop down list

oObj.importDataObject(counter.value);

var oDataObj = oObj.getDataObject(counter.value);

attachmentsList.addItem(oDataObj.path);

NoOfAttachments.formattedValue = 1;

}

//In remove button:

form1.page2.Button1::click - (JavaScript, client)

var oObj = event.target;

oObj.removeDataObject(attachmentsList.selectedIndex);

attachmentsList.deleteItem(attachmentsList.selectedIndex);

//In open button:

form1.page2.ViewAttachment::click - (JavaScript, client)

var oObj = event.target;

var sAttachObjName = attachmentsList.selectedIndex;

app.alert(attachmentsList.selectedIndex);

oObj.exportDataObject({ cName: sAttachObjName, nLaunch: 2 });

Would anyone please share why this is happening? Any help appreciated.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

_Bruce_Robertson

MVP

10-09-2018

Hi, In your code what is the NoOfAttachments object, I not sure how you assign a number to a formattedValue should throw an exception unless it is a string.  Do you have the "Show console and errors and messages" set in Acrobat?  But I don't think that is your problem and I would suspect the permissions as well, is it just some file types?  There are an number of customisations that can be made when Reader is installed.