带有asp验证器的jquery多步形式

时间:2015-03-26 17:14:59

标签: jquery asp.net

我正在尝试使用fieldsets在jquery中创建一个多步注册表单。在fieldset中我有多个带有asp验证器的文本框。那么我该怎么办呢,每当验证器触发错误信息时,字段集不应该移动到下一个字段集?

这是我的JavaScript:

$(document).ready(function(){

        $(".next_btn").click(function(){           //Function runs on NEXT button click 
            $(this).parent().next().fadeIn('slow');
            $(this).parent().css({ 'display': 'none' });
            //Adding class active to show steps forward;
            $('.activereg').next().addClass('activereg');
        });

    $(".pre_btn").click(function(){            //Function runs on PREVIOUS button click 
    $(this).parent().prev().fadeIn('slow');
    $(this).parent().css({'display':'none'});
//Removing class active to show steps backward;
    $('.activereg:last').removeClass('activereg');
    });


});

和我的aspx页面..

 <fieldset id="first" >
    <table style="vertical-align: text-top; text-align: left; width:950px"   >

    <tr>
                    <td style="width: 100px; text-align: left">
                        <asp:Label ID="Label2" runat="server" Text="Enrollment ID" Font-Bold="True"></asp:Label></td>
                    <td style="width: 141px">
                        <asp:TextBox ID="TextBox2" runat="server" Width="240px"  MaxLength="10" ></asp:TextBox></td>
                    <td>
                      <asp:RequiredFieldValidator ID="rfvTxtB2" runat="server" ControlToValidate="TextBox2" ValidationGroup="Validation1" Text="*" ForeColor="Red" Display="Dynamic"></asp:RequiredFieldValidator>
                          <asp:RegularExpressionValidator ID="revEnrollNo" runat="server"  ValidationExpression="^[0-9 ]+$" 
                     ControlToValidate="TextBox2" ErrorMessage="Enter Valid Enrollment ID" Display="Dynamic" ValidationGroup="Validation1"  EnableClientScript="true"/>
                    <td>
                    </td>
                    <td style="width: 100px">
                        </td>
                    <td style="width: 100px">
                    </td>
                </tr>

   <!--More textboxes and validators like above-->
    <input type="button" id="btn1" name="next" class="next_btn" value="Next" ValidationGroup="Validation1"/>
    </fieldset>

0 个答案:

没有答案