I have the following view in ASP.net MVC 3:
@model Models.CreateProjectViewModel
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
@using( Html.BeginForm() ) {
@Html.TextBoxFor(m => m.ProjectName)
@Html.ValidationMessageFor(m => m.ProjectName)
<p>
<input type="submit" value="Save" />
</p>
}
I am using unobtrusive javascript with jQuery and the Fluent Validation framework.
When I click the Save button and validation fails, is there some event I can hook into to call some custom javascript?
function validationFailed() {
// do something here only if validation failed
}
How would I tie into the validation so that when it failed (and only if it failed) I could call my validationFailed() function.