CaseyHunt CaseyHunt - 10 months ago 64
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.


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.