validating multiple textboxes in javascript

mcymcy

New Member
\[code\]<form name="quest" onsubmit="return validate();"> <table width="100%" border="1"> <tr> <td>Question</td> <td>&nbsp;</td> </tr> <tr> <td width="98">Response Type<font color="#CC0000">*</font></td> <td> <input type="radio" value="http://stackoverflow.com/questions/12812559/1" name="R1" onClick="showresponse(1)"> True/False <input type="radio" value="http://stackoverflow.com/questions/12812559/2" name="R1" onclick="showresponse(2)">Single Best Answer <input type="radio" value="http://stackoverflow.com/questions/12812559/3" name="R1" onclick="showresponse(3)">Multiple Answers</td> </tr> <tr> <td width="98" valign="top"><span id="lbl" >Add Response<font color="#CC0000">*</font></span></td> <td> <table border="0" width="425" cellspacing="0" id="response2" cellpadding="5"> <tr> <td width="161"> <input type="text" name="cb1" size="20" style="width:300px;" maxlength="100"></td> <td> <input type="radio" value="http://stackoverflow.com/questions/12812559/1" name="R3"> Answer</td> </tr> <tr> <td width="161"> <input type="text" name="cb2" size="20" style="width:300px;" maxlength="100"></td> <td> <input type="radio" value="http://stackoverflow.com/questions/12812559/2" name="R3"> Answer</td> </tr> <tr> <td width="161"> <input type="text" name="cb3" size="20" style="width:300px;" maxlength="100"></td> <td> <input type="radio" value="http://stackoverflow.com/questions/12812559/3" name="R3"> Answer</td> </tr> <tr> <td width="161"> <input type="text" name="cb4" size="20" style="width:300px;" maxlength="100"></td> <td> <input type="radio" value="http://stackoverflow.com/questions/12812559/4" name="R3"> Answer</td> </tr> <tr> <td width="161"> <input type="text" name="cb5" size="20" style="width:300px;" maxlength="100"></td> <td> <input type="radio" value="http://stackoverflow.com/questions/12812559/5" name="R3"> Answer</td> </tr> </table> </td> </tr> </table></form>\[/code\]I want to validate to that a person can enter min 3 responses(Add response) and max 5 responses. once enter the response only allow to select the answer(radio button). pls anbody help me . thanks in advance
 
Back
Top