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

Referencing text fields from another pdf

boykula
Registered: Apr 3 2008
Posts: 9
Answered

Is there a way to dynamically link two different text fields in two different pdf where if you change one, the other will change as well? I know this is possible if you export and import the form data, but that requires too many steps. Is there any other way to do this? Will scripting work?

- John

My Product Information:
Acrobat Pro 8.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can do this with a scirpt. But for it to work, both documents would have to be opened in Acrobat and both would need to be "disclosed".

Then you could concievably use the calculate event in one field to set the value of the other field in the other document.

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

starsailor3k
Registered: Dec 15 2009
Posts: 4
Is it possible to do the same between two XFA forms or between an acroform and an XFA?
I'm trying the first case but the only reference in the manuals (lc_designer_scripting_basics and lcdesigner_scripting_reference) is about global data binding.
I've tried to put in both forms
form1::docReady - (JavaScript, client)
event.target.disclosed=true;

But the global.variable syntax doesn't work even in assigning the values in form A, so I'm sure that also this code in form B is wrong:
global.subscribe("globA", IQA);
function IQA(str)// callback function
{............

Creating a script object is ok, for example:
globA.value=Page1.saveXML();
app.alert(globA.value);

but I think is only global inside the form.
Thanks in advance.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You should be able to get this to work between the different form types, but you have to use the correct syntax when referencing one document from the other, and when setting the disclosed.

For example, from an AcroForm an field in an XFA form is referenced like this.

oDocXFA.xfa.form.form1.page1.myTextField.rawvalue;

where "oDocXFA" is the document object for the XFA form, acquired from "app.activeDocs".

I'm not sure about the disclosure code. I haven't tried it. It may require an actual document level script to work. But I don't think so.

As for the global object, don't even try to use the subscribe event. It's never worked consistently, and now with the new security restrictions I think it's hopless.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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