The problem is that CherryPy will create a list only if there is more
than one item with the same "name" attribute. If not, then it will
create a single value. Of course a checkbox value is only included in
the form if the checkbox is checked.

The easy way round this is to use the formencode ForEach class:

from formencode.foreach import ForEach
from formencode import validators

W.CheckBoxList(name='topics',options=some_options,
validator=ForEach(convert_to_list=True))

In this case the ForEach validator should always create a list, however
many items there are.

This should really be a default validator for this class (or its base
class). I'll try some tests to see if this will work.

Reply via email to