CaseyHunt CaseyHunt - 1 year ago 147
Javascript Question

Copy field values in Acrobat using Javascript

How can I copy the form field values from one set of fields to another using javascript.

The idea here is to have a 'use shipping/billing address' type of button that copies the user information from one block of fields to another identical set of fields.

Right now, I call an action upon click of a button to execute the following javascript:

this.field1.value = this.field2.value;

However that action yields an 'undefined' error in the debugger.

Answer Source

For posterity, this is the solution to the problem:

getField("field2").value = getField("field1").valueAsString;

Also, note that field2 is set to field1 so the order is backwards.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download