On my ASP.Net MVC Web application, I am loading the following scripts on the _Layout.cshtml file:
@Scripts.Render("~/Scripts/modernizr-2.6.2.js")
@Scripts.Render("~/Scripts/jquery-2.2.3.js")
@Scripts.Render("~/Scripts/bootstrap.js")
@Scripts.Render("~/Scripts/respond.js")
@Scripts.Render("~/Scripts/toastr.js")
@Scripts.Render("~/Scripts/jquery-ui-1.11.4.js")
@Scripts.Render("~/Scripts/easyResponsiveTabs.js")
@Scripts.Render("~/Scripts/jquery.validate.js")
@Scripts.Render("~/Scripts/jquery.unobtrusive-ajax.js")
@Scripts.Render("~/Scripts/jquery.validate.unobtrusive.js")
Everything looks good until my first Post, that's when things get messy. When I post (via ajax) a form with client-side validations (for instance: an empty textbox marked as required) I do not see any validation error and the form is submitted to the server with errors on it.
However, if I call the last script once again:
@Scripts.Render("~/Scripts/jquery.validate.unobtrusive.js")
on every view with a form inside of it, everything works like a charm.
Do you have any idea about what might be happening? I believe I should not be forced to include the script back again on every partial view with a form I want to post...