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

Check box to copy a row to another row

DannyBoy
Registered: May 15 2011
Posts: 8

Ok if someone can explain and show a Javascript to this that will be great. I have a form with multiple pages. To make it simple I’m just going to say page 1 and 2. One page 1 I have a table with 7 rows. Each with fillable fields, for example name, DOB, Sex ect. Plus some questions. The main question in page 1 is “Is this person applying?” If they say yes then on page 2 I have a table of 6 to copy name, DOB, sex and other info. But if they say no then the info should not be transferred. The only thing I am coping are fields, no boxes. If person in line 1 pg 1 says yes then copy to line 1 in pg 2. If person in line 2 pg 1 says no then no copy. If person in line 3 pg 1 says yes then copy to pg 2 “line 2.” And so on. So I am trying to figure is there a simple Javasrcipt for this. Or is there a simpler way copy this info if they check yes to the check box? Is there any one that can help? In a simple way that I can copy the Javascript.
Thank you

My Product Information:
Acrobat Pro 9.4.3, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
There are two approaches to conditionally copying data between fields. The first method is to put some code on the check box mouse up event. This works fine as long as data is not being placed in the field from some other source, i.e., it's a single source transaction. But if the field can receive data from somewhere else, such as user input, then it gets more complicated and the best approach is to use a calculation script on the destination text field.

For example, if this is an AcroForm, then this code on the mouse up event of the check box will work.

if(event.target.value == "Yes")
this.getField("DestField").value = this.getField("SourceField");

Assuming of course that the export value of the check box is set to "Yes" which is the default.

To use a calculation script see this article:
http://acrobatusers.com/tutorials/conditional-execution

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