Solved

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

Posted on 2004-09-30
8
2,080 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Acrobat’s JavaScript is a great tool to extend the application, or to automate recurring tasks. There are several ways a JavaScript can be added to the application or a document (e.g. folder level scripts, validation scripts, event handling scripts,…
Update 21-May-2015: I temporarily removed the source code to make major changes to the program. Regards, Joe In a previous Experts Exchange article, How To Rename-Move a Batch of PDF Files Based on Contents of the Files (http://www.experts-exchan…
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…
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…

615 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