Click to See Complete Forum and Search --> : Form!
Jonathan
06-22-2003, 11:43 PM
How can you keep a textbox hidden until they click a required checkbox saying they agree. I need something like that... Thanks, or even better, a radio button! When a radio button is clicked then a textbox shows up next to it.
Jonathan
<form action="" name="myForm">
<input type="radio" name="myR" value="one" onClick="this.form.t1.style.visibility='visible';"> One
<input type="radio" name="myR" value="two" onClick="this.form.t2.style.visibility='visible';"> Two
<input type="radio" name="myR" value="three" onClick="this.form.t3.style.visibility='visible';"> Three
<br><br>
<input type="text" name="t1" style="visibility:hidden;"><br>
<input type="text" name="t2" style="visibility:hidden;"><br>
<input type="text" name="t3" style="visibility:hidden;">
</form>
Jona
Jonathan
06-23-2003, 01:24 AM
It didn't work... It just shows 3 textboxes and 3 radio boxes... help..?
This is a <hassle>forever</hassle>
I've edited my post.
Jona
Jonathan
06-23-2003, 11:10 AM
Thank you, but is there a way to make it like disabled when it is not clicked, just take one checkbox for an example... clicked a textbox opens up, but unclick box goes away
I've done this before with SELECT boxes. It should be easy enough for you to figure out how to make them work with radio buttons: http://jona.t35.com/experiments/show_hide_layers.html
Jona
Jonathan
06-23-2003, 11:42 AM
what about checkboxes?
This should do the trick:
<form action="" name="myForm">
<input type="checkbox" name="myR" value="one" onClick="if(this.form.t1.style.visibility=='visible'){this.form.t1.style.visibility='hidden';}else{this.form. t1.style.visibility='visible';}"> One
<input type="checkbox" name="myR" value="two" onClick="if(this.form.t2.style.visibility=='visible'){this.form.t2.style.visibility='hidden';}else{this.form. t2.style.visibility='visible';}"> Two
<input type="checkbox" name="myR" value="three" onClick="if(this.form.t3.style.visibility=='visible'){this.form.t3.style.visibility='hidden';}else{this.form. t3.style.visibility='visible';}"> Three
<br><br>
<input type="text" name="t1" style="visibility:hidden;"><br>
<input type="text" name="t2" style="visibility:hidden;"><br>
<input type="text" name="t3" style="visibility:hidden;">
</form>
Jona
Jonathan
06-23-2003, 12:02 PM
nothing shows up
Check the code again--you have to check a box. I changed it from radio buttons to checkboxes.
Jona
Jonathan
06-23-2003, 12:07 PM
Thank you very much