title: Problem when submit a form with select tag helper asp.net core 6
body: <p>I want to use select tag helper to choose a role for creating account in my web app.</p>
  <p>The following is my code</p>
  <pre><code>[HttpGet]
      public ActionResult Create()
      {
          var model = new AccountCreateViewModel()
          {
              Roles = new SelectList(_roleManager.Roles, &quot;Id&quot;, &quot;Name&quot;).ToList()
          };
  
          return View(model);
      }
  </code></pre>
  <p>The following is the code in view of the select.</p>
  <pre><code>&lt;div class=&quot;form-floating&quot;&gt;
      &lt;select asp-for=&quot;RoleId&quot; asp-items=&quot;@Model.Roles&quot; class=&quot;form-select&quot;&gt;&lt;/select&gt;
      &lt;label asp-for=&quot;RoleId&quot;&gt;&lt;/label&gt;
      &lt;span asp-validation-for=&quot;RoleId&quot; class=&quot;text-danger&quot;&gt;&lt;/span&gt;
  &lt;/div&gt;
  
  &lt;input type=&quot;submit&quot; class=&quot;w-100 btn btn-lg btn-primary&quot; /&gt;
  </code></pre>
  <p>The following is my model</p>
  <pre><code>public class AccountCreateViewModel
  {
      public RegisterModel.InputModel Input { get; set; } = new();
  
      [StringLength(50)]
      [Required]
      public string FullName { get; set; }
  
      [DataType(DataType.Date)]
      public DateTime? BirthDate { get; set; } = null;
  
      [StringLength(80)]
      public string Address { get; set; }
  
      [Required]
      [Display(Name = &quot;Role&quot;)]
      public string RoleId { get; set; }
      
      public List&lt;SelectListItem&gt; Roles { get; set; }
  }
  </code></pre>
  <p>However, after I submit the form, then the controller check the model state, and it is invalid. I have debugged and all the fields is valid except Roles.
  So, someone can give me a solution for this situation?</p>
  <p><a href="https://i.stack.imgur.com/6HNEC.png" rel="nofollow noreferrer">model state debugging </a></p>