views:

32

answers:

1

My setup is something like this:

radiobutton1 - selection1
radiobutton2 - selection2 textinput1

I want radiobutton1 to be selected whenever selection1 is changed, and I want radiobutton2 to be selected whenever either selection2 or textinput1 is changed.

There has to be a simple javascript solution here... I just can't find it.

Here's my actual code ("$semopt" is a string holding the html code for the options on the first selection input):

<input type='radio' name='semester' value='existing'/>Existing semester: 
    <select name='sem_id'">$semopt
    </select><br/>
<input type='radio' name='semester' value='new'/>New Semester: 
    <select name='sem_name'">
        <option value='Fall'>Fall</option>
        <option value='Spring'>Spring</option>
    </select> 
    <input name='sem_year' value='$thisyear' size='5'"/><br/>
+1  A: 

without resorting to "use jQuery" here's what you can do to your select tags.

    <select id="selection1" onchange="document.getElementById('radiobutton1').checked = true;">

do the same for the other one.

Tesserex
That was quick. Thanks!
Tim F.