PDA

View Full Version : Chained checkbox



icesolid
08-09-2007, 06:55 PM
I was wondering how I could have a checkbox that when selected displayed a selection box with values.

If the checkbox was unchecked it would hide the selection box and then clear the value of the selection box.

Any ideas?

Twey
08-09-2007, 07:00 PM
Have a look at http://www.twey.co.uk/?q=forms.

icesolid
08-09-2007, 07:07 PM
hmhmhm.... thats pretty cool.

I am looking for something a little more simple.

Just a checkbox, if selected it will show a selection box.

Unchecked the selection box disappears.

Twey
08-09-2007, 08:27 PM
<form action="">
<div>
<input type="checkbox" onclick="this.form.elements['myselect'].display = this.checked ? '' : 'none';">
<select name="myselect">
<option>An option</option>
<option>Another option</option>
</select>
</div>
</form>