PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/
__________________________________________________________________

You were close. When you define a function, you define something that is to
happen when invoked. You are only defining the action, and not invoking it.
Your choices here would be to:

1. Define the function (which you did) somewhere else, and then invoke it
from the button. When defining a function, one would normally do it in a
place where it can be easily used from more than one button (or other
event), probably in a Document Level javascript (accessed via
<Tools><Javascript><Document Javascript>). You could define the function as
(which you did):

    function CopyPrimaryInfo()
    {
      var primComp = this.getField("txtPrimComp");
      var shipComp = this.getField("txtShipComp");
      shipComp.value = primComp.value;
    }

and invoke it from your MouseUp event simply by

    CopyPrimaryInfo();

Or

2) Define and execute the function from the button event point itself, as
in:

    function CopyPrimaryInfo()
    {
      var primComp = this.getField("txtPrimComp");
      var shipComp = this.getField("txtShipComp");
      shipComp.value = primComp.value;
     }

    CopyPrimaryInfo(); 

Or (more likely)

3)From within your your MouseUp event by using code itself and not a
function, as in:

  var primComp = this.getField("txtPrimComp");
  var shipComp = this.getField("txtShipComp");
  shipComp.value = primComp.value;

In the last instance, you are not defining a separate action to be invoked,
you are just saying, "Do it".




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bill English
Sent: Saturday, December 13, 2003 11:37 PM
To: [EMAIL PROTECTED]
Subject: [PDF-Forms] copy field values - code assistance


PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/
__________________________________________________________________

I am just learning javascript for acrobat, and need help with a button 
function. On my form, there are text fields for primary contact info, 
shipping contact info, and billing contact info. I would like a button to 
"copy primary contact info" to shipping or billing fields.

I have inserted the following code on the 'Mouse Up' action for the button:
function CopyPrimaryInfo()
{var primComp = this.getField("txtPrimComp")
var shipComp = this.getField("txtShipComp")
shipComp.value = primComp.value
}

(This wold just copy the Company name, I would insert additional variables 
for name, address, etc.)

As is, this code does nothing. What am I doing wrong?

TIA -

Bill

_________________________________________________________________
Take advantage of our best MSN Dial-up offer of the year - six months 
@$9.95/month. Sign up now! http://join.msn.com/?page=dept/dialup


To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfforms.html




To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfforms.html

Reply via email to