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

Forms and Java Script

Chromebaby
Registered: Apr 12 2007
Posts: 2

Hi
 
I am creating a form which requires the user to copy and paste a great deal of text from a word processor file into two or three fields. What can I do to make the text automatically flow from the first field into the succeeding fields on following pages? I've seen a question about auto tabbing that has been answered by Thom Parker and I've tried to use the Java Script he's provided but I get a a syntax error message on line four. Can anyone help? I'm on a Mac running Acrobat Pro 7.0.9. Many thanks. Bill.

My Product Information:
Acrobat Pro 7.0.9, Macintosh
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
How you do this depends on what you mean by "flow from the first field into the succeeding fields". Do you mean that the text is divided up into pieces that exactly fill all the fields? Or that the text is parsed into recognizable quantities like "name", "phone", etc.

I'll assume you are parsing the data. This is not a trivial exercise. The practicality of automating this depends entirely on the consistancy of the data format pasted into the first field. For Example, one easy method of parsing is to divide the text into words like this:

var aWords = TextField1.rawValue.split(" ");

The text is split into an array by spaces. Now it can be placed in other fields.

FirstName.rawValue = aWords[0];
LastName.rawValue = aWords[1];
Phone.rawValue = aWords[2];

This is nice and simple as long as you can depend on the quanties not having any spaces. This scheme works well for text like this

Thom Parker 555-2222

But falls apart for a string like this

Dr. Thom P. Parker (503) 555 1212

So you see what I mean about it being non-trivial. If you have predictable formatting you can divy up the different bits pretty easily, but any variation means you have to impliment a much more complex scheme.

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