|
-
Nov 27th, 2010, 12:45 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] checkbox list ,requried field validator
see the code
Code:
<div id="list" class="right_txt_space_accm">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><strong></strong>
<asp:CheckBoxList ValidationGroup="testGroup" RepeatColumns=3 RepeatDirection=Horizontal ID="CheckBoxList1" runat="server">
<asp:ListItem Value="1">Cutomer Broker</asp:ListItem>
<asp:ListItem Value="2">N.V.O.C.C</asp:ListItem>
<asp:ListItem Value="3">Hauloiers</asp:ListItem>
<asp:ListItem Value="4">Air Freight</asp:ListItem>
<asp:ListItem Value="5">Sea Freight</asp:ListItem>
<asp:ListItem Value="6">Supply Chain Management</asp:ListItem>
<asp:ListItem Value="7">Groupage Services</asp:ListItem>
<asp:ListItem Value="8">Project Cargo</asp:ListItem>
<asp:ListItem Value="9">Ware House Operator</asp:ListItem>
</asp:CheckBoxList>
</td>
</tr>
</table>
</div>
<div style="display:none;">
<table>
<tr>
<td>
<asp:TextBox ID="txtcheckbox" ValidationGroup="testGroup" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="valCheckboxlist" runat="server" ValidationGroup=testGroup EnableClientScript=true ControlToValidate =txtcheckbox ErrorMessage="RequiredFieldValidator">*</asp:RequiredFieldValidator>
</td>
</tr>
</table>
</div>
and script is as
Code:
<script type="text/javascript">
$(function() {
function checkboxclicked() {
var n = $("# list input:checked").length);
$("input:#txtcheckbox").val(n==0 ? "" : n);
}
$(":checkbox").click(checkboxclicked) ;
});
}</script>
i need to validate the checkbox list(at least one checkbox is selected but its not doing any thing) ,can any one help me
There is no achievement without goals
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|