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

How to Seperate the Javascript from the Design Code...

aksahoo17
Registered: Sep 20 2010
Posts: 5

Hello
As i m a beginner to Acrobat LiveCycle Designer..i used both Javascript and the Form design codes in one page.
But as before HTML,ColdFusion etc we can use separate Javascript file as .js file and simply link through href="...\.js file" and its works accordingly.
 
But in this Acrobat LiveCycle I tried for this but failed..
 
Can anybody help me...specially George_Jhonson !
 
Thanks

My Product Information:
LiveCycle Designer, Windows
Echidna
Registered: Oct 25 2010
Posts: 3
Hi all,

I'm trying to do what I think is something similar.

I'm using Acrobat to generate/maintain PDFs, but I'd like to keep the Javascript separate for source control, maintenance and test purposes.

A case in point: I might have a validation function A embedded in a number of different PDFs. When I develop a better algorithm, A', I would want to replace A with A' automatically in all PDFs.

So, I would like to be able to open up a PDF in Acrobat, flush any Javascript in it and replace it with new code from an external .js file.

Is this possible? How do I do it?

Ta much.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Both Acrobat forms and LiveCycle Designer forms can use application folder level JavaScript, but these script files would need to be installed on each client (user) system's Acrobat application folder. This would also mean as the scripts are updated, then the new scripts files would need to be distributed and installed to replace the older script file. So unless you can update all user systems, this is not a very practical solution.

George Kaiser

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Yes, you can load code into a document from an external source a number of ways. One way is by importing a properly constructed FDF, for example: http://www.planetpdf.com/developer/article.asp?ContentID=6505

Another way is to use the doc.addScript method. You can automate this with an external program using IAC (InterApplication Communications). See the Acrobat SDK for more information.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
If you are using LiveCycle Designer forms, then the 'setAction' and 'importFDF' may not work.

George Kaiser