title: jquery validate always returning true
body: <p>I am using MVC4 w/JQuery and I have a form I created using the @Ajax.BeginForm. It has required fields (set on its view model). I am trying to validate the form before it is submitted back; however, it does not seem to validate.</p>
  
  <p>I had a submit button originally and it was just submitting the form. I changed the submit button to a regular button and tried calling $('#formname').validate() but it always returns true (even tho required fields are not filled in). Other views seem to work fine (that are not using the Ajax.BeginForm). </p>
  
  <p>I am referencing jquery, jquery-ui, jquery.validate, jquery.validate.unobtrusive, and jquery.unobtrusive-ajax.</p>
  
  <p>Anyone have any ideas/suggestions what I am missing?</p>
  
  <p>edit---------------------------------------------------------------------------</p>
  
  <p>Below is my code (this is inside a master page that references the jquery scripts):</p>
  
  <pre><code>@model AimOnlineMRA.Models.Reports.DateRangeViewModel 
  
  @using (Ajax.BeginForm("GetReport", "Reports", new AjaxOptions
  {
      UpdateTargetId = "report_pane", HttpMethod = "Post"}, new {@id="parameterForm"}))
  {
      @Html.AntiForgeryToken()
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          ApplyTheme();
  
          $('#btnYes').click(function() {
              $('#RunSpecificDateRange').val('true');
  
              $('#yesNo').hide();
              $('#dateRangeForm').show();
          });
  
          $('#btnCancel').click(function () {
              $('#report_pane').html('').hide();
          });
  
          $('#btnOk').click(function () {
              //if ($('#parameterForm').valid()) {
              //    alert('valid');
              //} else {
              //    alert('invalid');
              //}
          });
  
          $('#dateRangeForm').hide();
  
          $('#BeginDate').datepicker({
              showOn: 'button',
              buttonText: 'Date Picker',
              buttonImageOnly: true,
              buttonImage: '@Url.Content("~/Content/Icons/calendar-icon.png")'
          });
  
          $('#EndDate').datepicker({
              showOn: 'button',
              buttonText: 'Date Picker',
              buttonImageOnly: true,
              buttonImage: '@Url.Content("~/Content/Icons/calendar-icon.png")'
          });
      });
  &lt;/script&gt;
  
  &lt;div class="margin-auto" style="width: 400px"&gt;
  
      &lt;div id="yesNo"&gt;
          &lt;span class="bold"&gt;Do you want to run this report for a specific date range?&lt;/span&gt; 
          &lt;br /&gt;&lt;br /&gt;
          @Html.Button("Yes", "btnYes")
          @Html.Button("No", "btnNo")
      &lt;/div&gt;
      &lt;div id="dateRangeForm"&gt;
          &lt;span class="bold"&gt;Date Range&lt;/span&gt; 
          &lt;br /&gt;&lt;br /&gt;
          &lt;div class="left"&gt;
              &lt;div class="left clear-both"&gt;
                  @Html.LabelFor(x =&gt; x.BeginDate) &lt;br /&gt;
                  @Html.TextBoxFor(x =&gt; x.BeginDate, new {@style="vertical-align:top"})
                  @Html.ValidationMessageFor(x =&gt; x.BeginDate)
              &lt;/div&gt;
              &lt;div class="left clear-both m-top-5"&gt;
                  @Html.LabelFor(x =&gt; x.EndDate) &lt;br /&gt;
                  @Html.TextBoxFor(x =&gt; x.EndDate, new {@style="vertical-align:top"})
                  @Html.ValidationMessageFor(x =&gt; x.EndDate)
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="left m-left-10"&gt;
  
          &lt;/div&gt;
          &lt;div class="left clear-both m-top-10"&gt;
              @Html.Button("Ok", "btnOk")
              @Html.Button("Cancel", "btnCancel")
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  }
  </code></pre>
  
  <p>-----------------RESOLUTION-----------------------------</p>
  
  <p>calling <code>$.validator.unobtrusive.parse($('#parameterForm'));</code> before <code>$('#parameterForm').valid();</code> fixed the issue</p>