MVC 4 client side validation not working

后端 未结 21 1349
情话喂你
情话喂你 2020-12-02 14:00

Can anyone tell me why client side validation is not working in my MVC 4 application.

_layout.schtml

@Scripts.Render("~/bundles/jquery")
@R         


        
21条回答
  •  悲哀的现实
    2020-12-02 14:40

    There are no data-validation attributes on your input. Make sure you have generated it with a server side helper such as Html.TextBoxFor and that it is inside a form:

    @using (Html.BeginForm())
    {
        ...
        @Html.TextBoxFor(x => x.AgreementNumber)
    }
    

    Also I don't know what the jquery.validate.inline.js script is but if it somehow depends on the jquery.validate.js plugin make sure that it is referenced after it.

    In all cases look at your javascript console in the browser for potential errors or missing scripts.

提交回复
热议问题