Solved

Copy "actions" in form fields - **URGENT NEED HELP**

Posted on 2004-08-11
10
240 Views
Last Modified: 2012-06-22
I am creating a large amount of form fields in Acrobat 5.0.  Is there a way to copy the "actions" from one check box (or any form field) to another?  Many have the same actions and creating the same actions for 9 checkboxes is a bit tedious.

TIA.
0
Comment
Question by:Anjinsan5
  • 6
  • 4
10 Comments
 

Author Comment

by:Anjinsan5
ID: 11773936
by the way - i do understand that creating a single box, adding all actions, then copying it will copy the actions - but the forms are already there so I needed a way to easily simply copy properties from one to the other

/.nick
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 11774118
I was just about to tell you that you can copy the form fields with the actions, then I did a refresh, and found your second comment...

You can use JavaScript to set an action, but you cannot retrieve the action from a field. So, if you can code the action in JavaScript, you can then apply it to existing fields. You would do this with setAction() method of the FIeld object.
0
 

Author Comment

by:Anjinsan5
ID: 11774488
Unfortunatly JS is not my forte - is there a way to show/hide fields on mouse up via JS?

/.nick
0
 

Author Comment

by:Anjinsan5
ID: 11774679
basically i just need the syntax - if it exists
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 11775273
I think you misunderstood me: You can write a JavaScript to assign any action to a field. You can store this JavaScript on the application level, and e.g. execute it with a menu item in one of Acrobat's menus.

It doesn't make a lot of sense to try to come up with some code, not knowing what your exact problem is. Can you please provide a little more information about what you are trying to do. I'll be glad to give you JavaScript samples, or work with you so that you can come up with the solution, but I need more informaiton.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Anjinsan5
ID: 11775925
Basically I have the problem that certain fields need to be hidden and/or shown based upon check box or radio button selections (i.e. if Serial Comm is checked, serial comm properties become shown, if Parallel Comm is checked, serial get hidden, parallel comm settings fields will be shown).  It's easy to do this from within each single radio button (on mouse up, show/hide form fields).  Is there a way to do this in JS so i can cut and paste JS code and not continually select individual fields and assign the same properties to a number of check boxes?

/.nick
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 11789188
This sounds like copying the actions would not help: The action that is associated with a checkbox is specific to this box, and cannot be used for a different checkbox: The fields that would be enabled or disabled is specific to a checkbox.

You can use JavaScript to enable/disable fields: Add this JavaScript to the MouseUp action:

var f_hide = this.getField("TextToHide");
var f_show = this.getField("TextToShow");
var thisField = this.getField(event.targetName);

f_hide.hidden = (thisField.value == "Off");
f_show.hidden = (thisField.value == "Yes");


This is what's going on in these few lines:
You first create two variables for the fields you need to show or hide (TextToHide and TextToShow in this case). You also create a variable for the current checkbox (we do this by using the targetName for the current event).

In the second part, you are assigning a boolean value to the "hidden" property of the two fields.
0
 

Author Comment

by:Anjinsan5
ID: 11792455
I apologize for any confusion - let me further explain what I am trying to accomplish.

I am creating hardware setup sheets for my company's products.  In one section there is a set of radio buttons to select a Communication protocol to use:

Modbus
PC Link
SYNC

When you select one of these, the characteristics of each protocol must also be filled out.  So basically, if they select Modbus, I want the entire SYNC section to be hidden and the PC Link section as well.  If they pick PC Link, hide the other 2 section's fields, etc....  I just want to only allow users to fill out details of the sections they actually select.  There are other sections with radio buttons where the user can pick one of three choices, HEAT COOL RUN...if they select HEAT or COOL, more selections need to be filled out (so i want to show them) but if they pick RUN, i want to hide those fields.  Basically I want to make it impossible to fill the form out wrong.

I hope this helps.

/.nick
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
ID: 11801073
Let's see if we can make this work:
Do you know how to create radio buttons? If so, create three buttons for Modbus, PC Link and SYNC. Use the export values 0, 1, and 2. Create a Mouse Up action to run a JavaScript and add this to every button (it's the same for all three radio buttons):

selectFeature();

Then create a document level JavaScript (Advanced>JavaScript>Document JavaScript) with the name "selectFeature" and paste these lines into the edit box:

function selectFeature()
{
   var f = this.getField("Feature");
   console.println("setting value " + f.value);
 
   // f.value contains the currently selected setting of the check boxes
   var selection = f.value;

   // Modbus (setting == 0)
   f = this.getField("modbus_1");
   f.hide(selection != 0)
   f = this.getField("modbus_2");
   f.hide(selection != 0);
   
   // PC Link (setting == 1)
   f = this.getField("pclink_1");
   f.hide(selection != 1)
   f = this.getField("pclink_2");
   f.hide(selection != 1);

   // SYNC (setting == 2)
   f = this.getField("sync_1");
   f.hide(selection != 2)
   f = this.getField("sync_2");
   f.hide(selection != 2);

}

Replace the names that I used for the different fields (e.g. pclink_1 and pclink_2) with the fields you want to hide/unhide.
0
 

Author Comment

by:Anjinsan5
ID: 11840854
thanks so much!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Update 21-May-2015: I temporarily removed the source code to make major changes to the program. Regards, Joe INTRODUCTION This article presents a solution to a question (http://www.experts-exchange.com/Programming/Installation/Q_28396542.html)…
This article focuses on how to remove password security from multiple PDF files by Adobe Acrobat program. Sometimes it is essential to access the stored data items and to print, edit as well as copy content from Portable Document Format files in abs…
In this first video of the three-part Xpdf series, we introduce and describe Xpdf, a library containing nine command line utilities that perform various functions on PDF files. We show where the library is located and how to download it, discuss its…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now