disabled button after submit form with model validation asp.net core

You need use validate() method in jquery.validate.js(the js file has been referenced in _ValidationScriptsPartial.cshtml by default) to validate the form. Only when the validation passed, the button would be disabled:

@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
        $("#InsertCommentForm").on("submit", function(event) {
            var validator = $("#InsertCommentForm" ).validate();
            var flag = validator.form();


CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top