SnakeEyes909
IS-IT--Management
Hello, I am new to javaScript, and I am working on an Online Form for my company. I have the form done, and now i am working on validation. I have a "main section" which i have the validation for. I also have a section that askes 6 yes/no questions. I need to validate that one of the radio box's for each question has been checked. The catch is, if the Yes box has been checked it "unhides" a section of questions that are required to be filled in. If the no box is checked no validation is needed other than that it-itself has been checked. Part of the code follows. each radio button set (yes/no) has its own name ie "rad1, rad2" I've been pounding my head for the last few days on this, any help would be greatly appreciated.
PS. the form works great, i have only included a sample as the whole code would be to big to post.
thanks.
<table width="927" border="0">
<tr>
<td width="554">Are you currently under the care of a Home Health Care Nurse* </td>
<td width="171" align="center" valign="middle">
<input type="radio" name="rad1" value="yes" onClick="showhide(this.value,'divtxta')">Yes
<input type="radio" name="rad1" value="no" onClick="showhide(this.value,'divtxta')">No
</td></tr></table>
<div id="divtxta" style="visibility:hidden;">
<table width=927 border=0 >
<tr>
<td height=5 colspan=3> Please provide the name and a contact number for your Home Health Agency (Leave blank if No.)</td>
</tr>
<tr>
<td width="28" height="25"> </td>
<td width="567">Name*
<input name="HHAName" type="text" id="HHAName" size="60" /></td>
<td width="318">Phone*
<input name="HHAPhone" type="text" id="HHAPhone" size="30" /></td>
</tr>
</table>
</div>
<table width="927" border="0">
<tr>
<td width="565"><p>Has your home address changed since your last order?* </p></td>
<td width="171" align="center" valign="middle">
<input type="radio" name="rad2" value="yes" onClick="showhide(this.value,'divtxtb')">Yes
<input type="radio" name="rad2" value="no" onClick="showhide(this.value,'divtxtb')">No
</td></tr>
</table>
<div id="divtxtb" style="visibility:hidden;">
<table width="927" border="0">
<tr>
<td colspan="3">
<p>Please provide your new home address (Leave blank if No.) </p></td>
</tr>
<tr>
<td width="30"> </td>
<td width="121">Address*</td>
<td width="762"><input name="NewAddress" type="text" size="75" /></td>
</tr>
<tr>
<td> </td>
<td>Address 2 </td>
<td><input name="Address2" type="text" size="75" /></td>
</tr>
<tr>
<td> </td>
<td>City, State, Zip*</td>
<td><input name="City" type="text" />
<select name="NState" >
<option>OH</option>
<option>IN</option>
<option>MI</option>
<option selected> </option>
</select>
<input name="zip" type="text" /></td>
</tr>
</table>
</div>
PS. the form works great, i have only included a sample as the whole code would be to big to post.
thanks.
<table width="927" border="0">
<tr>
<td width="554">Are you currently under the care of a Home Health Care Nurse* </td>
<td width="171" align="center" valign="middle">
<input type="radio" name="rad1" value="yes" onClick="showhide(this.value,'divtxta')">Yes
<input type="radio" name="rad1" value="no" onClick="showhide(this.value,'divtxta')">No
</td></tr></table>
<div id="divtxta" style="visibility:hidden;">
<table width=927 border=0 >
<tr>
<td height=5 colspan=3> Please provide the name and a contact number for your Home Health Agency (Leave blank if No.)</td>
</tr>
<tr>
<td width="28" height="25"> </td>
<td width="567">Name*
<input name="HHAName" type="text" id="HHAName" size="60" /></td>
<td width="318">Phone*
<input name="HHAPhone" type="text" id="HHAPhone" size="30" /></td>
</tr>
</table>
</div>
<table width="927" border="0">
<tr>
<td width="565"><p>Has your home address changed since your last order?* </p></td>
<td width="171" align="center" valign="middle">
<input type="radio" name="rad2" value="yes" onClick="showhide(this.value,'divtxtb')">Yes
<input type="radio" name="rad2" value="no" onClick="showhide(this.value,'divtxtb')">No
</td></tr>
</table>
<div id="divtxtb" style="visibility:hidden;">
<table width="927" border="0">
<tr>
<td colspan="3">
<p>Please provide your new home address (Leave blank if No.) </p></td>
</tr>
<tr>
<td width="30"> </td>
<td width="121">Address*</td>
<td width="762"><input name="NewAddress" type="text" size="75" /></td>
</tr>
<tr>
<td> </td>
<td>Address 2 </td>
<td><input name="Address2" type="text" size="75" /></td>
</tr>
<tr>
<td> </td>
<td>City, State, Zip*</td>
<td><input name="City" type="text" />
<select name="NState" >
<option>OH</option>
<option>IN</option>
<option>MI</option>
<option selected> </option>
</select>
<input name="zip" type="text" /></td>
</tr>
</table>
</div>