Solved

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

Posted on 2004-09-30
8
1,843 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
 

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
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

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Power PDF (http://www.nuance.com/for-business/document-imaging-and-scanning/power-pdf-converter/index.htm) is the newest product from the Document Imaging division of Nuance Communications (http://www.nuance.com/). It is available in two editions — …
In this video, we show how to perform Bates Numbering/Stamping of PDF documents using Power PDF Advanced, the newest product from the Document Imaging division of Nuance Communications. There are two editions of Power PDF — Standard and Advanced. Th…
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…

757 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

23 Experts available now in Live!

Get 1:1 Help Now