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