I have been searching for days on how to insert a working "attach file" button into a PDF form I'm creating. I am working with LiveCycle ES4. I am able to open other examples where the "attach file" button works but when I try to implement in my own form, it doesn't work. I have tried using script from several examples but none work when I try to implement in my own PDF. Do I need to enable rights via LiveCycle somehow?
I have already tried the following:
//////////////////////////////////////////////////////// with this option, nothing happens when I click the button ////////////////////
form1.#subform[0].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.rawValue = 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.rawValue = 1;
}
////////////////////////////////////////