Solved

disable text field when check box clicked in acrobat (not a javascript question)

Posted on 2004-09-30
8
1,961 Views
Last Modified: 2011-12-30
I'm making an acrobat form.  I have two checkboxes and a text field.  When the "no" checkbox is clicked, I would like to disable the text field.   Anyone know how to do this?

Once again, this is an acrobat form.  This is not a javascript question.  I am using acrobat 6.0.

Thanks for your help in advance.  
0
Comment
Question by:diangysystems
  • 5
  • 3
8 Comments
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 200 total points
ID: 12192281
This actually is a JavaScript question: JavaScript is used in Acrobat to perform certain form actions. Is the "no" checkbox the only checkbox that changes the behavior of th text field, or are your two checkboxes actually radio buttons (one disables the text field, and the other one enables it?).
You can show or hide a form field with just a forms action, but in this case - because you can only show or hide, not both depending on the setting - you need to use JavaScript. If you are controlling the text field with just the one checkbox, do this:

Open the properties dialog for the checkbox and select the "Actions" tab. Select to "run a JavaScript" on the "Mouse Up" event, and click on the "Add" button. This will open a JavaScript editor. Type the following JavaScript (replace the names of the checkbox and the text field):

var cb = this.getField("CheckBox_No");
var tf = this.getField("Text_Field");

tf.hidden = (cb.value == "Yes");

Is this what you want?
0
 

Author Comment

by:diangysystems
ID: 12192508
after reading your response, i realize that you are correct.  i should be using a radio button for this.
can you let me know the js to run this with a radio button?  

thanks for your help.
0
 

Author Comment

by:diangysystems
ID: 12192709
oh another thing, the text fields are already hidden, so i would like them to be disabled as the no radio button is hit.

and how easy would it be to enable the text field again when the yes radio button is hit.

i know i'm asking for alot, i have increased the point value to 200.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:diangysystems
ID: 12192895
ok it looks like i figured it out.

the code works pretty much the same for the radio buttons.  

whats the opposite of "tf.hidden"?

thats all i need to do, be able to reshow the text field when the yes radio is pressed.  thanks.
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12193009
Just set tf.hidden to either true of false to hide/show the text field:

tf.hidden = true;

...

tf.hidden = false;
0
 

Author Comment

by:diangysystems
ID: 12193080
Here's my code

var rad1 = this.getField("radio1");
var tf1 = this.getField("text1");

tf1.hidden = (rad1.value == "No");

how would you show the text field again when the "Yes" button is selected?

0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 12193173
Use exactly the same code in your Yes button JavaScript: Because you are testing for (rad1.value == "No"), you will get "true" in once case and false" in the other case.

BTW: You can find the JavaScript documentation for Acrobat here: http://partners.adobe.com/asn/acrobat/docs.jsp#javascript
You need a free Adobe web account to download most of these documents. The one marked with a pad lock are only available to ASN members.
0
 

Author Comment

by:diangysystems
ID: 12193280
excellent.  thank you khkremer.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Update 21-May-2015: I temporarily removed the source code and the code snippets to make major changes to the program. Regards, Joe INTRODUCTION This Article is a follow-up to the Article entitled How To Rename-Move a Batch of PDF Files Based o…
The Adobe PDF proprietary file format is recognized as secure and formulated. But these PDF files are also prone to corruption and any external threat like virus attacks, improper storage can hit PDF file integrity.This type of damages can make cruc…
In this second video of the Xpdf series, we discuss and demonstrate the PDFimages utility, which, in a single command, is able to extract all the images from a PDF file and save each one in a separate image file (PBM, PPM, or JPG). Download and inst…
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…

856 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