MVC3 Unobtrusive Validation Not Working after Ajax Call

后端 未结 5 718
既然无缘
既然无缘 2020-12-04 08:03

Ok, here is the deal, I have seen a few posts on SO relating to this issue, but nothing is working for me.

Basically, I have select drop downs that are being load

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 08:39

    I could only get it the validation to work inside of OnComplete instead of OnSuccess:

    Here's the AJAX Code:

    @using (Ajax.BeginForm("Index", null, 
                           new AjaxOptions { OnSuccess = "onSuccess", 
                                             OnComplete = "onComplete"}, 
                           new { id = "mainForm" }))
    

    And here's my script:

    function onComplete(result) {
        $.validator.unobtrusive.parse("#mainForm");
        alert("Complete");
    };
    

提交回复
热议问题