Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

.execEvent("prePrint")

Avatar

Former Community Member

Hi,

I have used execEvent in the past to call a number of events, like "click", "full", "mouseEnter",  but have just been trying to call the "prePrint" event without success.  If I had the event name wrong I get an error message "Invalid enumerated value" but I am not getting any errors so assume "prePrint" is the correct text, but it is just not calling my code.

Is there some sort of trick to calling the prePrint event.

Thanks

Dave

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Dave,

To me it looks like you cannot call Application events (such as the prePrint event) using the execEvent() method.

Niall

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Hi Dave,

To me it looks like you cannot call Application events (such as the prePrint event) using the execEvent() method.

Niall

Avatar

Former Community Member

Niall is right .....you coudl call the print event and that in turn calls the prePrint

Paul

Avatar

Level 5

Hi,

As a possible workaround, you could put the code you want for the preprint in a script object as a function ( passing the objects you require) and then you could just call the function from where ever you are and this would run the same code in both occasions.

sorry it is a bit vague but not sure what you are wanting to run on the prePrint event.

Hope this helps

Malcolm

Avatar

Former Community Member

Hi Malcolm,

I was trying to get the ghost text, http://cookbooks.adobe.com/post_Adding_Ghost_Text_to_LiveCycle_Designer_form-18436.html, working on my form.  However, in my form some fields are enabled/disabled in which case I don’t want the ghost text.  I had thought I could call the prePrint/postPrint to clear and enable the null picture from my script object that disables/enables fields.  I sort of got it working using;

if (fieldNode.resolveNode("event__prePrint") !== null)
{
var contextSave = xfa.context;
xfa.context = fieldNode;
eval(fieldNode.event__prePrint.resolveNode("#script").value);
xfa.context = contextSave;
}

Then in the prePrint I need to change the code to (referenceing xfa.context instead of this);

xfa.context.format.picture.value = "";

But you are probably right, if I knew what I now know I would have used another script object.

Thanks

Dave