These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Embed Javascript in XDP data document

NK-INC.COM
Registered: Apr 17 2010
Posts: 93
Answered

Hello,
  
QUESTIONS:
A) Is it possible to embed javascript in XDP data documents?
 
B) If so, can you please provide an simple example of an XDP data document with an embeded javascript?
 
SCENERIO:
I would like to add a alert, ok/err, after the form has been submitted to a server side script for processing, and the xdp data document is returned from the server http response back to the browser with an embeded javascript. I would like to embed the alert javascript directly into the XDP data returned by the server. Sort of like the Status on an Acrobat Form.
 
I just need a simple example please.
 
Any help is very much appreciated!
  
Thank you.
   
Regards,
 
Nick

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
No, you can't put executable JavaScript into an XDP. But there are a couple of things you can do.

1. You can return FDF with a JS message in it. This used to be a great strategy. But unfortunately new security in Acrobat 9 can block FDF files from loading. There is a trust mechanism that has to be engaged to make this work.

2. Another strategy is to place a hidden field on the form that is only filled in by the returned XDP. Use a validation script to parse the returned info and then display a message to the user. Then delete the returned data from the field.


Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script