diangysystems
asked on
disable text field when check box clicked in acrobat (not a javascript question)
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
ASKER
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.
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.
Just set tf.hidden to either true of false to hide/show the text field:
tf.hidden = true;
...
tf.hidden = false;
tf.hidden = true;
...
tf.hidden = false;
ASKER
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?
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?
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.
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.
ASKER
excellent. thank you khkremer.
ASKER
can you let me know the js to run this with a radio button?
thanks for your help.