Permalink
Browse files

Merge pull request #92 from sontek/add-multiple-on-select

added the ability to flag a select as multiple-select
  • Loading branch information...
2 parents dd03a0a + e912044 commit df64b3fb8fbb064b9f2a8229a437dc025b129a8c @kiorky kiorky committed May 2, 2012
Showing with 10 additions and 2 deletions.
  1. +7 −2 deform/templates/select.pt
  2. +3 −0 deform/widget.py
@@ -1,9 +1,14 @@
+<input type="hidden" name="__start__" value="${field.name}:sequence"
+ tal:condition="field.widget.multiple" />
<select name="${field.name}"
id="${field.oid}"
- tal:attributes="size field.widget.size"
- tal:attributes="class field.widget.css_class">
+ tal:attributes="size field.widget.size;
+ class field.widget.css_class;
+ multiple field.widget.multiple">
<option tal:repeat="(value, description) values"
tal:attributes="selected value == cstruct and 'selected';
class field.widget.css_class"
value="${value}">${description}</option>
</select>
+<input type="hidden" name="__end__" value="${field.name}:sequence"
+ tal:condition="field.widget.multiple" />
View
@@ -741,12 +741,15 @@ class SelectWidget(Widget):
The template name used to render the widget in read-only mode.
Default: ``readonly/select``.
+ multiple
+ Enable multiple on the select widget ( default: ``False`` )
"""
template = 'select'
readonly_template = 'readonly/select'
null_value = ''
values = ()
size = None
+ multiple = False
def serialize(self, field, cstruct, readonly=False):
if cstruct in (null, None):

0 comments on commit df64b3f

Please sign in to comment.