title: JQuery validation for nested model
body: <p>I have this model:</p>
  
  <pre><code>public class TutorialBindingModel
  {
      [Required]
      [RegularExpression(@"[A-Za-z0-9\ \-_]+", ErrorMessage = "You are using invalid characters")]
      [StringLength(128, ErrorMessage = "The {0} must be max 128 characters long.")]
      public string Title { get; set; }
  
      public List&lt;SampleBindingModel&gt; Samples { get; set; }
  }
  
  public class SampleBindingModel
  {
      [Required]
      [StringLength(64, ErrorMessage = "The {0} must be max 64 characters long.")]
      [RegularExpression(@"[A-Za-z0-9\ \-_]+", ErrorMessage = "You are using invalid characters")]
      public string Name { get; set; }
  
      [Required]
      [StringLength(512, ErrorMessage = "The {0} must be max 64 characters long.")]
      [RegularExpression(@"[A-Za-z0-9\ \-_]+", ErrorMessage = "You are using invalid characters")]
      public string Description { get; set; }
  
  }
  </code></pre>
  
  <p>When I fill tutorial there is a button which creates new sample form with suited fields. Sample form is partial view with model <code>SampleBindingModel</code> so I just put <code>asp-for</code> on field and change <code>name</code> on <code>Samples[0].Name</code> for example. And I get correct markup where fields of nested model have validation attributes in html:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input class="item" name="Samples[0].Name" placeholder="Text" type="text" data-val="true" data-val-length="The Name must be max 64 characters long." data-val-length-max="64" data-val-regex="You are using invalid characters" data-val-regex-pattern="[A-Za-z0-9\ \-_]+"
    data-val-required="The Name field is required." id="Name" value=""&gt;
  &lt;span data-valmsg-for="Samples[0].Name" class="field-validation-valid" data-valmsg-replace="true"&gt;&lt;/span&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>But the issues is that I can't validate this sample form. Main model is validated correctly but not the nested one. I think it's because I create sample form dynamically and I need to set validator on this form but I can't think how to do that</p>