ASP.NET MVC “Ajax.BeginForm” executes OnSuccess even though model is not valid

前端 未结 5 1035
轻奢々
轻奢々 2020-12-14 09:01

I have a \"submit feedback\" form which uses \"Ajax.BeginForm\" to render a partial containing the form elements. The OnSuccess event is triggering even if the ModelState is

5条回答
  •  [愿得一人]
    2020-12-14 09:56

    You can do the following:

    var OnSuccess = function() {
        if ($(".validation-summary-errors").length == 0) { 
            //Your javascript/jquery code goes here
        }
    }
    

提交回复
热议问题