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

Jona
06-23-2003, 01:19 AM
<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>

Jona
06-23-2003, 01:27 AM
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

Jona
06-23-2003, 11:15 AM
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?

Jona
06-23-2003, 11:59 AM
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

Jona
06-23-2003, 12:05 PM
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

Jona
06-23-2003, 12:09 PM
Welcome you are.

Jona