title: Dynamically created inputs then getting data from inputs with flask
body: <p>I wrote some HTML and Javascript to create a table that has input fields that appear. Here is a picture of the <a href="http://i.stack.imgur.com/xJDFR.png" rel="nofollow">HTML Table</a>. When the user keeps clicking the button to add more it looks like this: <a href="http://i.stack.imgur.com/gLagy.png" rel="nofollow">HTML Table More Input</a></p>
  
  <p>Here is the HTML code for the table and the javascript to create more inputs:</p>
  
  <pre><code>&lt;form action="/information.html" method="POST"&gt;
      &lt;table class="table table-borderless"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th style="text-align:center"&gt;Ticker&lt;/th&gt;
                  &lt;th style="text-align:center"&gt;Shares&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody id='room_fileds'&gt;
              &lt;tr&gt;
                  &lt;td style="text-align:center"&gt;
                      &lt;fieldset class="form-group"&gt;
                          &lt;input type="text" placeholder="AAPL"   name="stock1"/&gt;
                       &lt;/fieldset&gt;
                   &lt;/td&gt;
                   &lt;td style="text-align:center"&gt;
                       &lt;fieldset class="form-group"&gt;
                          &lt;input type="text" placeholder="100" name="weight1"/&gt;
                       &lt;/fieldset&gt;
                   &lt;/td&gt;
               &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  &lt;br/&gt;
  &lt;input type="button" id="more_fields" onclick="add_fields();" value="Add More" /&gt; 
  &lt;input type='submit' value='Submit'/&gt;
  
  &lt;script&gt;
  var count = 0
  function add_fields() {
  count++
  var county = count.toString();
  var objTo = document.getElementById('room_fileds')
  var divtest = document.createElement("tr");
  divtest.innerHTML = '&lt;td style="text-align:center"&gt;&lt;input type="text"&gt;&lt;/td&gt;&lt;td  style="text-align:center"&gt;&lt;input type="text"&gt;&lt;/td&gt;';
  objTo.appendChild(divtest)
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I am trying to use flask to get all the post input. Usually I have an input with a name such as stock1 and then I do the following with flask: </p>
  
  <pre><code>stock1=request.form.get('stock1',type=str)
  </code></pre>
  
  <p>However, I am unsure of how to handle this type of dynamically created inputs. I am not sure if the user will enter data into 1 or 2 or even 25 input boxes. Is there a proper way to use flask to get all of this data if it is unknown how much data the user will enter? Possibly, I would like to get all of the tickers into a list and all of the shares into another list. </p>