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

Creating popups to customise a PDF

Tom
Registered: Mar 21 2007
Posts: 8

Hi,
 
I am struggling to get this relatively simple programme to work, and would be very grateful if anyone could offer any help.
 
I have a form that needs to be changed often, so I am trying to write a javascript that is triggered by a button and sets a series of prompts, like:
 
varTitle = app.response("Title of Meeting:","Customising");
 
OK so thats fine, then I need to replace the text field content with that of varTitle. This is where I have problems, I cannot seem to reference the field properly.
 
I have tried this.getField("MeetingTitle"); and get "null" as a response in the debugger, and trying to change properties of this says that it has no properties.
 
Any help would be greatly appreciated.
 
Thanks,
Tom

My Product Information:
Acrobat Pro 7.0.9, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Is this a LiveCycle (XFA) form? or was it made in Acrobat (AcroForms) using the Forms toolbar?
These are two very different forms technologies and have very different scripting models, i.e. Fields are accessed differently in each.

The next thing to check is the field name. Scripts are very picky about spelling. The names have to match exactly, even the upper and lower case letters.

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

Tom
Registered: Mar 21 2007
Posts: 8
I have been making the script in Acrobat Pro 7, mainly just testing code in the debugger window, but also trying to add scripts in the Batch Processing section. I have been unsuccessful in both attempts.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You've got the right idea. Get it working in the Console Window first. Your code looks fine, except that "varTitle" should be "var Title", because it's a variable declaration.

you should also protect the "getField" statment with a test for a real return value. The response function returns null when the user hits "cancel".

As for the code not working, the only reason the getField would return null is if no field exist on the current form with the name "MeetingTitle". Make sure the field name on your test form exactly matches the name of the field in your code.

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

madhuprasad
Registered: Jan 16 2008
Posts: 6
Hi

I got a new kind of requirement from my clients that need to fill the form through popup window options.
actual requirement is - when i click a button/textfield, this will generate a popup with multiple options and user will pick one and that will reflect in the form textfield.

I don't know how to create layers and am using Acrobat8, so it would be great if you could help me by creating a sample form with this requirement.

Thanks in advance!!

Thanks!