Solved

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

Posted on 2004-08-11
10
242 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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
 

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

One of the questions I get asked again and again is how to validate a field value in an AcroForm with a custom validation script. Adobe provided a lot of infrastructure to do that with just a simple script. Let’s take a look at how to do that wit…
Update 21-May-2015: I temporarily removed the source code and the code snippets to make major changes to the program. Regards, Joe A recent question here at Experts Exchange piqued my interest, so I decided to provide a thorough solution and publ…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

820 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