I have many "polls" in my webapp, in which I have them all showing up on the same page, but cannot figure out how to have one submit(vote) button for all of the forms. As of right now, they all have their own vote buttons for each question, but I would like just one at the bottom to submit everything.
My HTML code for this template is as follows:
{% if latest_question_list %}
{% for question in latest_question_list %}
<h2>{{ question.question.text }}</h2>
<form action="{% url 'polls:vote' question.id %}" method="post">
{% csrf_token %}
{% for choice in question.choice_set.all %}
<input type="radio" name="choice" id="choice{{ for loop.counter }}" value="{{ choice.id }}" />
<label for="choice{{ forloop.counter }}">{{ choice.choice_text }}</label><br />
{% endfor %}
<input type="radio" name="choice" value="">Other: <input type="text" />
<br><input type="submit" value="Vote" /></br>
</form>
{% endfor %}
{% else %}
<p>No polls are available.</p>
{% endif %}
Is there an easy way to do this? I appreciate any help! Thanks.