Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

script to open attachment panel

Avatar

Level 4

Hi!


Is there a way to open one of the panels when a pdf is opening?

I have forms (livecycle ES) that users can attach pdf to. I would like that when the form is sent to the next person in the flow. I open the attachment panel in reader, so that the user can see attachments


I have a method to check if attachments have been added, so if not possible, I can add a big textbox to check attachment panel.. but the other way would be better


soo come on.. give me your great ideas


/Thomas Groenbaek, Jyske Bank

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

This Javascript:

app.execMenuItem("ShowHideFileAttachment");

will toggle the attachment panel open / closed.

If you put this in an early event (Form: Ready, Initialise) then if the form is saved with the attachment panel open, then the script will close it.

Because of this I don't see much value in tracking if new documents are attached, because the one script shows and hides the panel alternatively.

On one project we included a numeric field that showed the number of documents that were attached and if this was greater than 0, then a paperclip button was visible (with app.execMenuItem("ShowHideFileAttachment"); in the click event).

03-08-2009 18-27-18.png

The numeric script looked like:

var oObj = event.target;
var fileAttachments = oObj.dataObjects;

if (fileAttachments != null)
{
    this.rawValue = fileAttachments.length;
}

if (this.rawValue > 0)
{
    attachImage.presence = "visible";
}

Hope that helps,

Niall

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

This Javascript:

app.execMenuItem("ShowHideFileAttachment");

will toggle the attachment panel open / closed.

If you put this in an early event (Form: Ready, Initialise) then if the form is saved with the attachment panel open, then the script will close it.

Because of this I don't see much value in tracking if new documents are attached, because the one script shows and hides the panel alternatively.

On one project we included a numeric field that showed the number of documents that were attached and if this was greater than 0, then a paperclip button was visible (with app.execMenuItem("ShowHideFileAttachment"); in the click event).

03-08-2009 18-27-18.png

The numeric script looked like:

var oObj = event.target;
var fileAttachments = oObj.dataObjects;

if (fileAttachments != null)
{
    this.rawValue = fileAttachments.length;
}

if (this.rawValue > 0)
{
    attachImage.presence = "visible";
}

Hope that helps,

Niall