Solved

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

Posted on 2004-08-11
10
239 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The ability to edit PDF documents can be useful, however it may not be a straight forward process. Many non-technical people don't realise that a PDF document is basically an image rather than a text file, even if it contains nothing but text. If…
PDF files have been in the limelight due to its unmatched features.  Personal documents, emails, business reports and eBooks are all converted into PDF files owing to peerless features provided by it. Adding watermark to a PDF file is a method to se…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

707 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

16 Experts available now in Live!

Get 1:1 Help Now