JQuery 플러그인으로 .Net 양식의 유효성 검사를 설정했는데 모든 것이 페이지로드에서 작동하지만 포스트 백 작업 후에 유효성 검사가 중지됩니다.jQuery 유효성 검사 플러그인. 게시가 끝난 후 유효성 검사가 작동하지 않습니다.
그런 다음 requiered 필드를 비우고 제출하려고하면 .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>
희망 누군가가 잘못하고 무엇을 메신저에 저를 가리킬 수 있습니다 : 여기
문제를 재현 작은 코드 샘플입니다.