I'm hoping you can provide me with some guidance. I have a registraion form setup with javascript validation in place, but there is one place I'm having trouble. I have a dropdown selection list, and based on the selection, there are text fields that are hidden or displayed for more info. So if you select the second item in the drop down, a text field associated with that selection appears. My issue is how to make that text field required, but only required based on drop down selection. I know there are ways to do this with radio buttons and checkboxes, but can it be done with dropdowns as well? The form is large so I didn't want to paste all here, but the snap shot of the items I'm referring to are:
<tr><td colspan=2 width="525" align="center">
<a class="form">Please let us know how you learned about us.<br></a></td></tr>
<tr>
<td colspan=2 width="525" align="center" class="form">
<select id="dropdown1" name="dropdown" onchange="display(this,'Google Search','Yahoo Search','Bing Search');" size="1" style="width:320px; font-size:11px; font-weight: bold; color: #686363;">
<option>Please select:</option>
<option value="Google Search">Google Search</option>
<option value="Yahoo Search">Yahoo Search</option>
<option value="Bing Search">Bing Search</option>
<option value="Other">Other</option>
</select> *
</td>
</tr>
</thead>
<tbody id="Google Search" style="display: none;">
<tr>
<td class="form" align="right"><br><br>Keywords used for search <font color="red">(Required)</font>: </td>
<td class="field"><br>
<input type="hidden" class="tbox1" id="textfield14" name="googlekey" size="40" value="-" />
<input type="text" class="tbox1" id="textfield14" name="googlekey" size="40" value="" /></td>
</tr>
</tbody>
<tbody id="Yahoo Search" style="display: none;">
<tr>
<td class="form" align="right"><br><br>Keywords used for search <font color="red">(Required)</font>: </td>
<td class="field"><br>
<input type="hidden" class="tbox1" id="textfield15" name="yahookey" size="40" value="-" />
<input type="text" class="tbox1" id="textfield15" name="yahookey" size="40" value="" /></td>
</tr>
</tbody>
Is it possible to make the the text field with name=googlekey required if some selects Google Search in drop down...but not required if they make some other selection? Thanks, David
[Edited by catron on 16-Feb-11 13:51]