title: Getting data from form asp.net core
body: <p>I am beginner in asp.net core.
  I got problem with getting data from view form.  I want to create "Word" object depends on data from dynamically generated  divs => inputs with class names "RussianTranslation" and "English Translation" and after fill List Words using created words. There is no problem with getting data as "Title" or "Level", problem only in getting list of words. And after send this modeol to database. I dont know how to parse these dynamically generated divs. I hope you understand my problem and you will help me :)</p>
  
  <p>There are my files:</p>
  
  <p>There is a class from ViewModels "CreateModel": </p>
  
  <pre><code>public class CreateModel
  {
      [Required]
      public string Title { get; set; }
  
      [Required]
      public string Level { get; set; }
  
      [Required]
      public DateTime Date { get; set; }
  
      public List&lt;Word&gt; Words { get; set; }
  
      public CreateModel()
      {
          Words = new List&lt;Word&gt;();
  
      }
  }
  </code></pre>
  
  <p>Class Word:</p>
  
  <pre><code> public class Word
   {
      [Key]
      public int WordId { get; set; }
      public string RussianTranslation { get; set; }
      public string EnglishTranslation { get; set; }
   }
  </code></pre>
  
  <p>And view with form :</p>
  
  <pre><code>    &lt;form id="my-form" name="my-form" method="post" asp-controller="CreateTest" asp-action="Create"&gt;
                  &lt;div class="form-group row"&gt;
                      &lt;label asp-for="Title" class="col-md-4 col-form-label text-md-right"&gt;Title&lt;/label&gt;
                      &lt;div class="col-md-6"&gt;
                          &lt;input asp-for="Title" type="text" id="first_name" class="form-control" name="Title"&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="form-group row"&gt;
                      &lt;label asp-for="Level" class="col-md-4 col-form-label text-md-right"&gt;Level&lt;/label&gt;
                      &lt;div class="col-md-6"&gt;
                          &lt;input asp-for="Level" type="text" id="last_name" class="form-control" name="Level"&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
  
                  &lt;div class="col-md-6 offset-md-4"&gt;
                      &lt;button type="submit" class="btn btn-primary"&gt;
                          Create
                      &lt;/button&gt;
                  &lt;/div&gt;
  
  
                  &lt;br /&gt;
                  &lt;div class="col-md-6 offset-md-4"&gt;
                      &lt;button type="button" onclick="AddWord()" class="btn btn-primary"&gt;
                          Add New Word
                      &lt;/button&gt;
                      &lt;button id="delete" type="button" onclick="DeleteWord()" class="btn btn-danger"&gt;
                          Delete Word
                      &lt;/button&gt;
                  &lt;/div&gt;
  
                  &lt;br /&gt;
                  &lt;div name="Words"  id="last"&gt;
  
                  &lt;/div&gt;
  
              &lt;/form&gt;
  </code></pre>
  
  <p>And also my js file:</p>
  
  <pre><code>function AddWord() {
  
  var div = document.createElement("div");
  div.className = "form-group row container-fluid justify-content-xl-between";
  
  
  var label1 = document.createElement("label");
  label1.innerText = "Russian:"
  label1.className = "col-md-4 col-form-label text-md-right";
  label1.setAttribute("asp-for", "RussianTranslation");
  
  var label2 = document.createElement("label");
  label2.innerText = "English:"
  label2.className = "col-md-4 col-form-label text-md-right";
  label2.setAttribute("asp-for", "EnglishTranslation");
  
  var input_div1 = document.createElement("div");
  input_div1.className = "col-md-6";
  
  var input_div2 = document.createElement("div");
  input_div2.className = "col-md-6";
  
  var inner_div1 = document.createElement("div");
  inner_div1.className = "col-md-6";
  
  var inner_div2 = document.createElement("div");
  inner_div2.className = "col-md-6";
  
  var input1 = document.createElement("input");
  input1.type = "text";
  input1.setAttribute("asp-for", "RussianTranslation");
  input1.name = "RussianTranslation";
  
  var input2 = document.createElement("input");
  input2.type = "text";
  input2.setAttribute("asp-for", "EnglishTranslation");
  input2.name = "EnglishTranslation";
  
  var extra = document.createElement("div");
  extra.className = "col-md-6";
  
  
  input_div1.appendChild(input1);
  input_div2.appendChild(input2);
  
  inner_div1.appendChild(label1);
  inner_div1.appendChild(input1);
  inner_div2.appendChild(label2);
  inner_div2.appendChild(input2);
  
  
  div.appendChild(inner_div1);
  div.appendChild(inner_div2);
  
  document.getElementById("last").appendChild(div);
  
  }
  </code></pre>
  
  <p>P.S. I am bad in frontend dev don't be angry for my script-code or for my html-code ;)</p>