Expand my Community achievements bar.

Names of Attachments within a PDF

Avatar

Former Community Member

Hi All,

I have a button which attaches a file

In the click event of the button:

app.execMenuItem("AddFileAttachment");

Which is working fine.

Now, I want to access the absolute file name of the attachment and display it in the text area in the PDF.

Can i access it in LiveCyle Designer through javascript coding?

Thanks

Abhiram

5 Replies

Avatar

Level 5

Hi,

You could use code something like this from a button or some other event.

var d = event.target.dataObjects;

for (var i = 0; i < d.length; i++)

{

     console.println("Data Object[" + i + "]=" + d[i].name);

}

I have just written the  name to the console, but you could write it to any field.
Hope this helps
Malcolm

Avatar

Former Community Member

Thank you so much Malcolm..

One more question reg. this

I want to automatically populate the text field with attachment names whenever a file is attached/an attachment is deleted.

Pls let me know in which event can i write this code.

Thanks

Abhiram

Avatar

Level 5

Hi,

just adding it after your current button click event should work.

app.execMenuItem("AddFileAttachment");

var d = event.target.dataObjects;

for (var i = 0; i < d.length; i++)

{

    TextField.rawValue =  d[i].name;

}

Hope this helps

Malcolm

Avatar

Former Community Member

Ya . But this wil not work in the cases when user add/remove attachments from the attachments panel.

So i was looking for an event which fires immediately when a user attaches/removes file from the attachment panel, so that the text field refreshes automatically.

hope i m clear.

Thanks

Abhiram

Avatar

Level 2

Hi,

Did you manage to find a solution regarding this issue "So i was looking for an event which fires immediately when a user attaches/removes file from the attachment panel, so that the text field refreshes automatic"

If yes can you please share it