How webapp2 get checkbox values from jinja2 templates, and the name is the same ? Is the data structure is Dict ? How can get it and pass it ?
html templates:
...
{% for tablename in tablenames %}
<input type = "checkbox" name = "tn">{{tablename}}
{% endfor %}
...
main.py:
tn = self.request.get('tn')
Thank you guys : )
How get the checkbox value and pass it into tn ?
I think your template should be...
{% for tablename in tablenames %}
<input type="checkbox" name="tn" value="{{ tablename }}" />
{% endfor %}
And the code should be (I believe that .GET
also handles .POST
vars as well in WebApp2):
tn = self.request.GET['tn']