Need to make a textbox required if radio button is selected
Hello all. New user (and new to javascript) looking for some guidance.
I have a form with a radio button list that contains 4 selections (A,B,C and "Other"). The "Other" option has a textbox next to it that I want to make required if the "Other" option is selected from the list.
Any help would be greatly appreciated.
Thanks,
Mike
Here's the code I am going to work with...
Here is the code. I apologize, the tool I am forced to use to make these forms throws in a lot of clunky code and I haven't cleaned it up yet:
<!--Begin Question 6 -->
<table class="space2" cellspacing="0" cellpadding="0" width="750" border="0">
<tbody>
<tr><td>My biggest obstacle to growth and success in 2009 is:</td></tr>
<input type="hidden" value="q132" name="qNo6">
<input type="hidden" value="radio" name="132QuestType">
<tr><td colspan="4"><input type="radio" value="1" name="q132"> Financial/Profitability<br />
<input style="HEIGHT: 20px" type="radio" value="2" name="q132"> Employee Management<br />
<input style="HEIGHT: 20px" type="radio" value="3" name="q132"> Infrastructure<br />
<input style="HEIGHT: 20px" type="radio" value="4" name="q132"> Other <---- Here is the Other radio button option. If it is selected I want to make the textbox a required input
<input style="HEIGHT: 20px" type="textbox" onchange="javascript: autocheckRadio(this,6,4) " size="25" value="" name="textBoxQ132Ans4"> <----The texbox
<br /></td></tr>
<tr><td style="WIDTH: 175px"> </td><td style="WIDTH: 150px"> </td><td style="WIDTH: 125px"> </td><td style="PADDING-RIGHT: 75px; WIDTH: 300px" nowrap="true"><input style="FLOAT: right; MARGIN-LEFT: 8px; POSITION: relative; HEIGHT: 31px" onclick="javascript: doSubmit();return false; " type="image" src="/uploadImages/SubmitButton.jpg" value="" name=""></td>
</tr>
</tbody>
</table>
<!-- END: Question 6 -->