I am using http://dingyonglaw.github.com/bootstrap-multiselect-dropdown/#forms to display a dropdown with multiple check boxes.
<li>
<label>
<input type="checkbox" name="filters" value="first value">
<span>First Value</span>
</label>
</li>
<li>
<label>
<input type="checkbox" name="filters" value="second value">
<span>Second Value</span>
</label>
</li>
This is the resulting URL:
http://example.com/search?filters=first+value&filters=second+value
On Server side (bottle):
terms = unicode (request.query.get ('filters', ''), "utf-8")
will give me only "second value" and ignore "first value". Is there a way of collecting all the 'filters' values?
Use the request.query.getall
method instead.
FormsDict is a subclass of MultiDict and can store more than one value per key. The standard dictionary access methods will only return a single value, but the MultiDict.getall() method returns a (possibly empty) list of all values for a specific key.