Here is my code for a table the “Add” button adds a dynamic row into the table.
I need to do a client side validation for the table so tht all the text boxes and the selection boxes shall have a value entered or selected. None should be left epty as well atleast one row of the table shall be complete.
Please help me with the validation
<div style=”display:block; float:left; width: 480px; border:0px solid #F00;”>
<table border=”0″ cellpadding=”1″ cellspacing=”0″ id=”tbl1″>
<thead>
<tr>
<th width=”120″>Name</th>
<th width=”60″>Port </th>
<th width=”60″>Index</th>
<th width=”120″>Connection</th>
<th width=”60″>Status</th>
<th width=”24″> </th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan=”6″><input type=”button” name=”button” onClick=”new(‘tbl1’)” value=”Add” /></td>
</tr>
</tfoot>
<tbody>
<tr>
<td width=”120″><input type=”text” name=”Name[]” size=”15″ /></td>
<td width=”60″><input type=”text” name=”Port[]” size=”4″ /></td>
<td width=”60″><input type=”text” name=”Index[]” size=”4″ /></td>
<td width=”120″><select name=”Connect[]” ><option selected >-Select-</option>
{html_options options=$lstConType}</select></td>
<td width=”60″><select name=”Status[]” ><option selected >-Select-</option>
{html_options options=$lstStatus}</select></td>
</tbody>
</table>
</div>