Difference between revisions of "Implementing HTML CheckBoxes in Jinja"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) |
PeterHarding (talk | contribs) |
||
Line 3: | Line 3: | ||
* http://stackoverflow.com/questions/7996075/iterate-through-checkboxes-in-flask | * http://stackoverflow.com/questions/7996075/iterate-through-checkboxes-in-flask | ||
* https://coderwall.com/p/pkthoa/read-checkbox-in-flask | * https://coderwall.com/p/pkthoa/read-checkbox-in-flask | ||
* http://thefort.org/tag/python/ | * http://thefort.org/tag/python/ Uses WTF | ||
Revision as of 11:02, 25 December 2014
Notes
- http://stackoverflow.com/questions/7996075/iterate-through-checkboxes-in-flask
- https://coderwall.com/p/pkthoa/read-checkbox-in-flask
- http://thefort.org/tag/python/ Uses WTF
Example
Template
{% for contact in contacts %} <input type="checkbox" id="id_{{contact.id}}" name="contacts" value="{{contact.id}}"> <label for="id_{{contact.id}}">{{contact.name}}</label> {% endfor %}
Flask
if request.method == "POST": selected_contacts = request.form.getlist("contacts")