Posted By

JoseKar on 09/06/11


Tagged

checkbox validator custom


Versions (?)

Custom validator para validar un checkbox


 / Published in: VB.NET
 

  1. <script type="text/javascript">
  2. function ValidateCheckBox(sender, args) {
  3. if (document.getElementById("<%=chkAcepto.ClientID %>").checked == true) {
  4. args.IsValid = true;
  5. } else {
  6. args.IsValid = false;
  7. }
  8. }
  9. </script>
  10.  
  11. <asp:CheckBox ID="chkAcepto" runat="server" Checked="false" />
  12. <asp:CustomValidator ID="reqCheckBox" runat="server" ErrorMessage="Obligatorio"
  13. ClientValidationFunction = "ValidateCheckBox" />

Report this snippet  

You need to login to post a comment.