JUst try it with the following code. Hope this helps...
var oObj = event.target;
var fileAttachments = oObj.dataObjects;//dataObjects returns all dataObjects(attachments)in the pdf
//attachmentsList is a listbox field in the form listing all the attachments included
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 is the text field showing total no. of attachments
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;
}
thanks.
Balaji