Expand my Community achievements bar.

SOLVED

Is there an event that fires when adding attachments

Avatar

Former Community Member

Is there some way to add JavaScript to run when a user attaches a file?

1 Accepted Solution

Avatar

Correct answer by
Level 5

Hi,

There is not event that fires, but you could control the JavaScript to add the attachment using the importDataObject (see the Acrobat JS API Reference document for details), if you don't specify the cDIPath parameter it will display a dialog.

You could then run additional JavaScript after you have made the above call, the function returns true if it was able to import the file and therefore you could use this to control if you run you code or not.

The Acrobat JS API reference document can be downloaded as part of the SDK from here - http://www.adobe.com/devnet/acrobat/sdk/eula.html

or the online version is here - http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_AcroJSPreface.87.1.html

To use the 'doc' object from acrobat in LiveCycle Designer change the 'doc' part to 'event.target'

Hope this helps

Malcolm

View solution in original post

2 Replies

Avatar

Correct answer by
Level 5

Hi,

There is not event that fires, but you could control the JavaScript to add the attachment using the importDataObject (see the Acrobat JS API Reference document for details), if you don't specify the cDIPath parameter it will display a dialog.

You could then run additional JavaScript after you have made the above call, the function returns true if it was able to import the file and therefore you could use this to control if you run you code or not.

The Acrobat JS API reference document can be downloaded as part of the SDK from here - http://www.adobe.com/devnet/acrobat/sdk/eula.html

or the online version is here - http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_AcroJSPreface.87.1.html

To use the 'doc' object from acrobat in LiveCycle Designer change the 'doc' part to 'event.target'

Hope this helps

Malcolm

Avatar

Former Community Member

Thanks for the response. I do already have code for adding the attachments. The users still want to add additional attachments through the built in functionality. This question was just an alternative solution to a problem I resolved in another way. I had code in the preSubmit event that dealt with attachments. preSubmit does not fire when saving a draft in workspace. If there were an event, i would run the code each time a file were attached. I ended up putting code in the form bridge in the function called when Save is clicked.