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

前端 未结 5 1038
轻奢々
轻奢々 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:51

    Slight variation on Luis' answer:

    function OnSuccess() {
        if ($("span[class='field-validation-error']").length == 0) {
            alert("Target Platform saved Successfully.");
        }
    }
    

提交回复
热议问题