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

Amy:
This can be done fairly easily using Javascript. I wrote a small program
that I run from another PDF file (PDF files can "talk" to each other through
their document objects)
The PDF file has a couple of fields which contain the script you want to
update, a string to match field names to (assuming you don't want to update
all the fields) and the field event handler you want to change. Attach the
script to button (see details below) 

Feel free to use the script or adapt it for your specific needs.

//------------------------------------ cut here
-----------------------------------
/* 
 Required Fields: 
 ActionString : contains the script to be used in the update
 ActionList   : a list field containing all the event types (e.g. MouseDown,
MouseUp, Keystroke, etc.
 ActionField : a regular expression match for the field(s) to update ("*"
would match all for example)

 Required Global vars:
 theDoc : the document object of the form to be modified. This is obtained
from the app.activeDocs function,
   which lists all the disclosed , open , PDF files. 
   (NB: the target PDF file must have this.disclosed = true; run in to be
seen)
 
 Function:
 Iterates through all fields in the target form and checks for regexp match
to contents of ActionField. If a match 
 exists asks user if they want to update and only update if Yes is returned.

 Installation: 
 Put this script in the mouseUp event handler of a button on a separate PDF
file with the required fields. 
 Add a script or function to select the document object of the PDF file you
want to change and assign it to
 theDoc.

*/

if (typeof(theDoc) != "undefined")
 {
  var theString=getField("ActionString").value;
  var tmp=getField("ActionField").value;
  var theAction=getField("ActionList").value;

  if (tmp == "")
   {
    app.alert("fill in the fields first!",1,0);
   } else
   {
    var tomatch=new RegExp(tmp);
    var curF="";
    var resp=0;
    for (var i=0;i<theDoc.numFields;i++)
     {
      curF=theDoc.getNthFieldName(i);
      if (tomatch.test(curF))
       {
        resp=app.alert("Do "+curF+"?\rType is
:"+theDoc.getField(curF).type+"\rOn Page:
"+theDoc.getField(curF).page+"\rReadOnly:
"+theDoc.getField(curF).readonly+"\rHidden: "+theDoc.getField(curF).hidden,
2,3)
        if (resp == 4)
         {
          theDoc.getField(curF).setAction(theAction,theString);
         }
        if (resp == 2)
         {
          i=theDoc.numFields+1
         }
       }
     }
   }
 }

Regards

Rob Cairns 
Senior Technical Specialist - I & C Computers 
Safety Related Computers 
Computers and Control Design Department 
Ontario Power Generation Incorporated 
H12 G27 
e-mail: [EMAIL PROTECTED] 


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Amy Sachs
Sent: Tuesday, April 13, 2004 12:27 PM
To: [EMAIL PROTECTED]
Subject: [PDF-Forms] Same Javascript for All Fields


Hello everyone!  I really hope you can help me.  I have designed a form
which has many fields on it.  To help users fill it out I would like the
field to be highlighted in color when someone tabs into it.  I have the code
and now I am just having a problem getting the code to show up in all the
fields.  I have done this once before a long time ago and of course now I'm
suck.  If I can avoid entering this script for each individual field it
would save me a ton of time. Any help would be great and Tim G. if you're
out there you helped me with this one before!  Thanks ahead of time.

Thanks,
Amy



Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway - Enter today


--------------------------------------------------------------
THIS MESSAGE IS ONLY INTENDED FOR THE USE OF THE INTENDED RECIPIENT(S) AND MAY CONTAIN 
INFORMATION THAT IS PRIVILEGED, PROPRIETARY AND/OR CONFIDENTIAL.  If you are not the 
intended recipient, you are hereby notified that any review, retransmission, 
dissemination, distribution, copying, conversion to hard copy or other use of this 
communication is strictly prohibited.  If you are not the intended recipient and have 
received this message in error, please notify me by return e-mail and delete this 
message from your system.  Ontario Power Generation Inc.

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

Reply via email to