title: How can I generate buttons or fields (forms) in Flask according to a list of strings?
body: <p>Well, suppose we have a list of strings (objects with a toString() method respectively) and a jinja2 template that shall have selection forms (buttons or something alike) that agree in number and label to the list. This list may alter during the session. So far, I tried to work with submit buttons and radio buttons. Problems are: submit buttons vary in size because of different string length and I dislike that radio buttons force the user to first make a choice and then submit it.</p>
  
  <p>The jinja2 markup looks like this:</p>
  
  <pre><code>&lt;form method = 'post' action= "{{ url_for('add_dialogue_turn') }}"&gt;
  {% if questions %}
  {% for q in questions %}
  &lt;input type="radio" name="question" value={{q}}&gt; {{q}} &lt;br&gt;
  {% endfor %}
  {% endif %}
  &lt;input type="submit" /&gt;&lt;br /&gt;&lt;br /&gt;
  &lt;/form&gt; 
  </code></pre>
  
  <p>The flask function looks like this:</p>
  
  <pre><code>@app.route("/turn", methods=['POST'])
  def add_dialogue_turn():
      label = request.form["question"]
      print(label)
      return render_template("sometemplate.html",    questions=aListOfQuestions, answers = aListOfAnswers)
  </code></pre>
  
  <p>Can I make the radio buttons submit the value directly after ticking off the circle? Or can I define some field that returns the string when clicking on it?</p>
  
  <p>Thank you for your help in advance!</p>