Validating Checkboxlist

Asked

Viewed 28 times

0

I am using this form validation with text fields. However, I am not getting it with checkboxList. Is there a way or a way to do this? Follow the code below.

function form_validation() {
        $("#aspnetForm").validate({
            errorElement: 'span',
            errorClass: 'help-block',
            rules: {
                ctl00$ContentPlaceHolder1$txtDataInicioEmissao: {
                    required: true
                },
                ctl00$ContentPlaceHolder1$txtDataFimEmissao: {
                    required: true
                },
                ctl00$ContentPlaceHolder1$chkLstOrigem: {
                    checkrequired: true
                }
            },
            messages: {
                ctl00$ContentPlaceHolder1$txtDataInicioEmissao: {
                    required: "<%= Resources.UIResource.PreenchaOcampo %>"
                },
                ctl00$ContentPlaceHolder1$txtDataFimEmissao: {
                    required: "<%= Resources.UIResource.PreenchaOcampo %>"
                }
            },
            highlight: function (element) { // entradas de erro do hightlight
                $(element)
                    .closest('.form-group').removeClass('has-success').addClass('has-error'); // definir a classe de erro no form-group
            },
            unhighlight: function (element) { // reverter a mudança feita pelo hightlight
                $(element)
                    .closest('.form-group').removeClass('has-error'); // definir a classe de erro no from-group
            }
        });
        return true;
      }
  • Como esta sua html? poderia postar aqui também?

  • <div class="col-md-11">&#xA; <asp:Panel ID="pnl1" runat="server" ScrollBars="Vertical" Height="80px" CssClass="form-control painelListOrigem">&#xA; <asp:CheckBoxList ID="chkLstOrigem" runat="server" CssClass="checkbox chkLstOrigem"> </Asp:Checkboxlist> </Asp:Panel> </div> <div class="col-Md-1"> <span class="require">*</> </div> </div>

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.