Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-30
8
Medium Priority
?
2,182 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 600 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] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

 

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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

*Adobe Acrobat 9 was used for this article. Particular steps may vary depending on software versions. 1. Create a framework of your form in Word, leaving space where you’d ultimately like the Adobe fields to appear.  (Note: I use the blank lines …
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 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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

715 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