0
我已經設置了驗證。淨形式與jQuery插件上,一切正常,在頁面加載,但回發確認後停止工作。jQuery驗證插件。後經過驗證工作不回來
然後,如果我空需要選用一個領域,試圖提交,當我的.Net驗證抓住問題的客戶端,然後在字段中的現場驗證再次開始工作。
這裏是重現該問題小的代碼示例:
<script language="javascript">
$(document).ready(function() {
ValidateElements();
});
function ValidateElements() {
jQuery.validator.messages.required = " ";
jQuery.validator.messages.email = " ";
var rules = {};
rules[$("#<%=TxtInvoiceName.ClientID%>").attr("name")] = {
required: true
};
$('form').validate({
rules: rules,
success: function (label) {
},
errorPlacement: function (label) {
}
});
$("#MainForm").validate().form();
}
</script>
<style>
input.error {
border: 1px solid red;
}
</style>
<form id="MainForm" runat="server">
<div>
<asp:TextBox runat="server" ID="TxtInvoiceName" Text="" />
<asp:RequiredFieldValidator ID="RequiredFieldInvoiceName" runat="server" ErrorMessage=""
Display="Dynamic" ControlToValidate="TxtInvoiceName"></asp:RequiredFieldValidator>
<asp:Label runat="server" ID="LblTxtInvoiceNameValidate" AssociatedControlID="TxtInvoiceName"> </asp:Label>
<asp:Button runat="server" Text="PostBack" OnClick="PostBack" />
</div>
</form>
希望有人能指出我什麼即時做錯了。