2013-04-29 54 views
0
<div id="rgform" class="register_form"> 
      <label for="rg_form_name">Adınız</label><asp:TextBox ID="rg_form_name" CssClass="txtfld" runat="server"></asp:TextBox> 
      <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="rg_form_name" ErrorMessage="Adınızı Giriniz" ForeColor="Red"></asp:RequiredFieldValidator> 
      <br /> 
      <label for="rg_form_surname">Soyadınız</label><asp:TextBox ID="rg_form_surname" CssClass="txtfld" runat="server"></asp:TextBox> 
      <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="rg_form_surname" ErrorMessage="Soyadınızı Giriniz" ForeColor="Red"></asp:RequiredFieldValidator> 
      <br /> 
      <label for="rg_form_email">E-Posta</label><asp:TextBox ID="rg_form_email" CssClass="txtfld" runat="server"></asp:TextBox> 
      <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="rg_form_email" ErrorMessage="E-Posta Giriniz" ForeColor="Red"></asp:RequiredFieldValidator> 
      <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="rg_form_email" ErrorMessage="Geçerli Bir E-Posta Adresi Giriniz" ForeColor="Red" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator> 
      <br /> 
      <label for="rg_form_phone">Telefon</label><asp:TextBox ID="rg_form_phone" CssClass="txtfld" runat="server"></asp:TextBox> 
      <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="rg_form_phone" ErrorMessage="Telefon Giriniz" ForeColor="Red"></asp:RequiredFieldValidator> 
      <br /> 
      <label for="rg_form_address" style="vertical-align:top;">Adres</label><asp:TextBox ID="rg_form_address" CssClass="txtfld_multiline" Columns="50" Rows="5" runat="server" TextMode="MultiLine"></asp:TextBox><br /> 
      <asp:Button ID="Register_Button" CssClass="register_button" runat="server" Text="Kayıt Ol" OnClick="Register_Button_Click" /> 
     </div> 
     </div> 

     <script> 
      $('form').submit(function() { 
       $('#rgform').hide(); 
      }); 

     </script> 

當我點擊按鈕,驗證控件不起作用,表單提交所以,div hide.how解決?如何隱藏div點擊按鈕與asp.net驗證

+0

你檢查瀏覽器控制檯對任何錯誤? – 2013-04-29 10:36:59

回答

0

嘗試返回false,如果形式是無效的:

$('form').submit(function() { 
    var isValid = validateForm(); 
    if(isValid){ 
    $('#rgform').hide(); 
    } 
    return isValid; 
}); 

或者,如果你想隱藏的形式,無論形式是否有效。

$('form').submit(function() { 
    var isValid = validateForm(); 
    $('#rgform').hide(); 
    return isValid; 
}); 
+0

仍然不工作,現在驗證控制工作,但div不要隱藏 – 2013-04-29 10:46:10

+0

即使它成功/失敗你想隱藏嗎? – ysrb 2013-04-29 11:04:59

+0

當我提交表單(成功)時我想隱藏,但是當我點擊隱藏的div時,將這些字段留空,所以驗證控件不工作 – 2013-04-29 11:10:09

相關問題