MVC3을 사용 중이고 모델 유효성 검사에 필수 속성을 추가했습니다. 그런 다음 jquery 대화 상자 (아약스 대화 상자 아님)가있는 페이지를 만들었습니다. 이 경우 유효성 검사가 작동하지 않습니다. 하지만 대화 상자에서 html을 페이지에 붙여도 제대로 작동합니다.jquery 대화 상자에서 모델 유효성 검사가 작동하지 않습니다.
신체가 문제를 해결하는 방법을 알고 있습니까? 당신은 당신의 대화의 내부 양식 태그를 이동해야
$(document).ready(function() {
$("#registerDialog").dialog({ autoOpen: false, show: "blind", hide: "explode", modal: true, resizable: false, height: 570, width: 390 });
$(".headerButton").button();
$(".accountBtn").button();
$('ul').roundabout({ autoplay: 'false', autoplayDuration: 3000 });
$("#registerBtn").click(function() {
$("#registerDialog").dialog("open"); return false; });
$("#closeRegisterDialog").click(function() { $("#registerDialog").dialog("close");
});
$("#registerBtnSbmt").click(function() {
$("#registerForm").submit(); return false; });
})
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { id = "registerForm" }))
{
<div id="registerDialog" title="Регистрация">
@Html.LabelFor(x => x.FirstName)
<br/>
@Html.TextBoxFor(x => x.FirstName, new { @class = "registerUser" })
<br/>
@Html.ValidationMessageFor(x => x.FirstName)
<br/>
@Html.LabelFor(x => x.LastName)
<br/>
@Html.TextBoxFor(x => x.LastName, new { @class = "registerUser" })
<br/>
@Html.ValidationMessageFor(x => x.LastName)
<br/>
@Html.LabelFor(x => x.Email)
<br/>
@Html.TextBoxFor(x => x.Email, new { @class = "registerUser" })
<br/>
@Html.ValidationMessageFor(x => x.Email)
<br/>
@Html.LabelFor(x => x.Password)
<br/>
@Html.TextBoxFor(x => x.Password, new { @class = "registerUser" })
<br/>
@Html.ValidationMessageFor(x => x.Password)
<br/>
@Html.LabelFor(x => x.ConfirmPassword)
<br/>
@Html.TextBoxFor(x => x.ConfirmPassword, new { @class = "registerUser" })
<br/>
@Html.ValidationMessageFor(x => x.ConfirmPassword)
<br/>
@Html.CheckBoxFor(x => x.RememberYou) запомнить Вас?
<br/>
<br/>
@Html.ActionLink("Сохранить", "LogIn", "Account", null, new { @class = "accountBtn", style = "font-size: 0.8em;", id = "registerBtnSbmt" })
<a href="#" class="accountBtn" id="closeRegisterDialog" style = "font-size: 0.8em;">Закрыть</a>
</div>
}
당신이 대화 –
$ (문서)를 생성하는 데 사용하는 코드를 게시 할 수 있습니다 .ready (함수() { $ ("# registerDialog") 대화 상자 ({ 에 AutoOpen. : 거짓,쇼 : "블라인드", 숨기기 : "폭발", 모달 : 사실, 크기 조정 : 거짓, 높이 : 570, 폭 : 390 }); – Radislav
$ (". headerButton"). button(); $ (". accountBtn"). button(); $ ('ul').원형 교차로 ({autoplay : 'false', autoplayDuration : 3000});$ ("# registerDialog") 대화 상자 ("열기"); $ ("# closeRegisterDialog"). (function() { $ ("# registerDialog") 대화 상자를 클릭하십시오. $ ("# registerBtnSbmt")을 클릭하십시오. (function() { $ ("# registerForm") submit(); false를 반환; }}); }}); – Radislav