CheckBox Validation: JavaScript
<script type="text/javascript" language="javascript">
function ValidateCheckBox(src, args)
{
if (document.getElementById('<%=chk_Terms.ClientID %>').checked == false)
{
alert("Please check Terms & Conditions before continuing.");
//return false;
args.IsValid = false;
}
}
------------------------------------------------
<asp:CheckBox ID="chk_Terms" runat="server" CssClass="arial11normalblack" Text="I agree to the Terms & Cconditions" />
<asp:CustomValidator ValidationGroup="submit" ID="cv_Checkbox" runat="server" ClientValidationFunction="ValidateCheckBox"
Display="None" SetFocusOnError="True">*</asp:CustomValidator>
<script type="text/javascript" language="javascript">
function ValidateCheckBox(src, args)
{
if (document.getElementById('<%=chk_Terms.ClientID %>').checked == false)
{
alert("Please check Terms & Conditions before continuing.");
//return false;
args.IsValid = false;
}
}
------------------------------------------------
<asp:CheckBox ID="chk_Terms" runat="server" CssClass="arial11normalblack" Text="I agree to the Terms & Cconditions" />
<asp:CustomValidator ValidationGroup="submit" ID="cv_Checkbox" runat="server" ClientValidationFunction="ValidateCheckBox"
Display="None" SetFocusOnError="True">*</asp:CustomValidator>
0 comments:
Post a Comment