Solved

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

Posted on 2004-09-30
8
2,017 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

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,…
Can Be Caused By Disabled Services I have encountered a problem viewing PDF files using Adobe Acrobat Reader.  For the longest time, PDFs might launch or might not.  Sometimes they took about 15 minutes to appear after launching them. After som…
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…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

710 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