Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Pre-populate one form with data from another

Avatar

Former Community Member
I have a form with fields for some user info and a list of forms that the user wants to open. User fills in data and chooses the form to open, the new form should open with pre-filled user info from another form. Is it possible to do so? and most imporatntly how?

Can somebody please help me.

Thanks
9 Replies

Avatar

Level 6
It is possible. A former colleague of mine did it. The trick is to use the "global" object, which is part of the Acrobat scripting model. From the Adobe Javascript Guide:



The global object is used to store data that is persistent across invocations of Acrobat or shared by multiple documents. Global data sharing and notification across multiple documents is done through a subscription mechanism, which enables monitoring of global variables and reporting of their values to all subscribing documents. In addition, global may be used to store information that pertains to a group of documents, a situation that occurs when a batch sequence runs. For example, batch sequence code often stores the total number of documents to be processed as a property of global. If information about the documents needs to be stored in a report object, it is assigned to a set of properties within global so it is accessible to the report object.



I suggest you start there. Good luck!



Jared Langdon

www.jlangdon.ca

Avatar

Former Community Member
I have been trying to do this as well with no luck :(



Can you please explain with an example. I thought 'global' would work only when data needs to be prefilled from one section of a SINGLE form to another section of the SAME form. Isn't it?



How do we define that the data has to come from another form?



please help!!



Danny

Avatar

Level 6
I wish I could help more, but I don't have a sample. I know that it can be done because I've seen it done and I did it myself about a year and a half ago, but I don't have those files anymore. The best I can do is give you some clues. If you work it out, maybe you can post the solution in more detail.



Okay, let's see what else I can remember about how to do this. Say you have two forms - let's call them the "source" PDF and the "destination" PDF.



1) Enter the data into the "source" PDF

2) Click a button to "share" the data with another PDF

3) On that "share" button's click event, take the information you want to share (possibly the entire data DOM as XML) and store it in a global variable. Global variables exist outside of the form - they are in the host (i.e. Reader or Acrobat). To be clear, I'm referring to the Global object, which is part of the Acrobat scripting model. See the documentation at http://www.adobe.com/devnet/acrobat/pdfs/js_api_reference.pdf.

3) After parking the data you want to share, open the "destination" PDF using app.openDoc. Again, this is from the Acrobat scripting model, not the LiveCycle model.

4) On form ready of the "destination" PDF, access the global variable that the other form created and read in the data.



For kicks I had a quick glance at the newest (version 8) documentation for Acrobat JavaScript. It seems that there are some new security restrictions surrounding the use of the global object, which may throw a wrench. So I'll take back my "I know it works" statement and replace it with "I know it used to work".



Hope this helps.



Jared Langdon

www.jlangdon.ca

Avatar

Former Community Member
Oh I wish I knew scripting well!! I am reading the api ref you sent and hopefully I will be able to understand some.



Please do share any more infor , if you have on this topic. Thanks a lot for your help!!



Danny

Avatar

Former Community Member
Is there some more info available on this topic anywhere?

Avatar

Former Community Member
All my efforts are in vain. Can anybody please help as to get one name field from one form to another??



Desperate Danny

Avatar

Former Community Member
Can somebody from Adobe please reply?



Danny

Avatar

Former Community Member
Hi,



another suggestion, that may work in your situation, is to pass them through the url.



Here is an example I read on a previous post:



http://www.peakforms.com/pdfs/get2pdf2.pdf?First=Neptuno&Last=&Whisky=



See the topic entitled: "Open pdf file with parameters". Look through the script object code.



John Revoy

Avatar

Former Community Member
Danny,

You have to create an XML schema that should be used by both documents.

Once you have created the schema, and embeded it on both forms, you can bind the data you want to appear in the destination form.