When we create a project in Asp.Net it by default inserts some validators to be used with Razor, @Html.ValidationMessageFor(model => model.property)
.
I saw in different projects that these messages are generated by returning the controller
, that is, when the form is sent, it checks the ModelState
and according to the response, it brings the required fields and so "active "the message for what is missing, however, I have also seen in some projects that it does not need to enter controller
to perform the verification, what I need to know is what defines this situation.
What does the validator do before entering controller
to know which fields are required to be filled in?
EDITION:
I think it's better to insert the javascripts that perform the validations and also the others I use to find out if any are getting in the way.
Follow the code below:
<script src="~/Scripts/jQuery-2.1.4.min.js"></script>
<script src="~/Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<script src="~/Scripts/bootstrap.min.js" type="text/javascript"></script>
<link href="~/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/template/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
@*USAR NESTA ORDEM*@
<link href="~/Content/template/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
<link href="~/Content/jquery-confirm.css" rel="stylesheet" type="text/css" />
<link href="~/Content/meucs.css" rel="stylesheet" type="text/css" />
<script src="~/Scripts/angular.min.js"></script>
<script>angular.module("Angular", []);</script>
<script src="~/Scripts/tecbox/MainController.js"></script>
<script src="~/Scripts/modernizr-2.8.3.js" type="text/javascript"></script>