title: jquery validation plugin with partial view ajax loaded
body: <p>I'm using <a href="http://jqueryvalidation.org/" rel="nofollow noreferrer">Jquery Validation</a> plugin for validate my remotely loaded partial view form modal . </p>
  
  <pre><code>var formDataSource = $('#frmDataSource').validate({
      rules: {
          provider: { required: true },
          stype: { required: true },
          url: { required: true },
          uname: { required: true, digits: true },
          pword: { required: true }
      },
      messages: {
          provider: { required: 'Please enter provider name' },
          stype: { required: 'Please select type' },
          url: { required: 'Please enter url' },
          uname: { required: 'Please enter user name' },
          pword: { required: 'Please enter password' }
      },
      errorPlacement: function(error, element) {
          error.insertAfter(element.parent());
      },
      submitHandler: function (form) {
           //submit form
      }
  });
  </code></pre>
  
  <p>My Partial view </p>
  
  <pre><code>&lt;div class="modal-body no-padding"&gt;
      @using (Html.BeginForm("AddProvider", "DataSource", FormMethod.Post, new { id = "frmDataSource", @class = "smart-form" }))
      {
          &lt;fieldset&gt;
              &lt;div class="row"&gt;
                  &lt;section class="col col-5"&gt;
                      &lt;label class="select"&gt;
                          &lt;i class="icon-append fa fa-question-circle"&gt;&lt;/i&gt;
                          @Html.DropDownList("providers", ViewBag.ProviderSelectList as List&lt;SelectListItem&gt;, new { name = "provider", placeholder = "Provider Name" })
                          &lt;i&gt;&lt;/i&gt;
                      &lt;/label&gt;
                  &lt;/section&gt;
                  &lt;section class="col col-3 col-lg-offset-3"&gt;
                      &lt;label class="toggle"&gt;
                          @Html.CheckBoxFor(d =&gt; d.IsActive, new { name = "chkbxactive" })
                          &lt;i data-swchon-text="ON" data-swchoff-text="OFF"&gt;&lt;/i&gt;Active
                      &lt;/label&gt;
                  &lt;/section&gt;
  
              &lt;/div&gt;
              &lt;div class="row"&gt;
                  &lt;section class="col col-5"&gt;
                      &lt;label class="select"&gt;
                          &lt;select name="stype" class="input-sm" required=""&gt;
                              &lt;option value="1"&gt;FTP&lt;/option&gt;
                          &lt;/select&gt; &lt;i&gt;&lt;/i&gt;
                      &lt;/label&gt;
                  &lt;/section&gt;
                  &lt;section class="col col-5"&gt;
                      &lt;label class="input"&gt;
                          &lt;i class="icon-append fa fa-question-circle"&gt;&lt;/i&gt;
                          @Html.TextBoxFor(d =&gt; d.Address, new { name = "url", placeholder = "URI" })
                          &lt;b class="tooltip tooltip-bottom-right"&gt;&lt;i class="fa fa-warning txt-color-teal"&gt;&lt;/i&gt; URI&lt;/b&gt;
                      &lt;/label&gt;
                  &lt;/section&gt;
              &lt;/div&gt;
              &lt;div class="row"&gt;
                  &lt;section class="col col-5"&gt;
                      &lt;label class="input"&gt;
                          &lt;i class="icon-append fa fa-question-circle"&gt;&lt;/i&gt;
                          @Html.TextBoxFor(d =&gt; d.UserName, new { name = "uname", placeholder = "Username" })
                          &lt;b class="tooltip tooltip-bottom-right"&gt;&lt;i class="fa fa-warning txt-color-teal"&gt;&lt;/i&gt; Username&lt;/b&gt;
                      &lt;/label&gt;
                  &lt;/section&gt;
                  &lt;section class="col col-5"&gt;
                      &lt;label class="input"&gt;
                          &lt;i class="icon-append fa fa-question-circle"&gt;&lt;/i&gt;
                          @Html.TextBoxFor(d =&gt; d.Password, new { name = "pword", placeholder = "Password", type = "password" })
                          &lt;b class="tooltip tooltip-bottom-right"&gt; &lt;i class="fa fa-warning txt-color-teal"&gt;&lt;/i&gt; Password&lt;/b&gt;
                      &lt;/label&gt;
                  &lt;/section&gt;
              &lt;/div&gt;
          &lt;/fieldset&gt;
          &lt;footer&gt;
              &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;
                  Cancel
              &lt;/button&gt;
              &lt;button id="btn-frmsubmit" type="submit" class="btn btn-info"&gt;
                  Save
              &lt;/button&gt;
          &lt;/footer&gt;
      }
  &lt;/div&gt;
  </code></pre>
  
  <p>above code isn't validating and submitting then i tried this</p>
  
  <pre><code>$(document).on('submit', '#frmDataSource', function(e) {
      e.preventDefault();
      var validator = $("#frmDataSource").validate({
          rules: {
              provider: { required: true },
              stype: { required: true },
              url: { required: true },
              uname: { required: true, digits: true },
              pword: { required: true }
          },
          messages: {
              provider: { required: 'Please enter provider name' },
              stype: { required: 'Please select type' },
              url: { required: 'Please enter url' },
              uname: { required: 'Please enter user name' },
              pword: { required: 'Please enter password' }
          },
          errorPlacement: function(error, element) {
              error.insertAfter(element.parent());
          }
      });
  
  })
  </code></pre>
  
  <p>still form isn't submitting what was the problem with my code ?
  how to submit form when it remotely loaded?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>as requested <a href="https://stackoverflow.com/users/594235/sparky">Sparky</a></p>
  
  <ul>
  <li><p>Simply validation is not working because validation rules not</p></li>
  <li><p>applying. There's no console error because it's not a error. it's not
  applying validation rules.</p></li>
  </ul>
  
  <p>Regards</p>