Hi,

I've a small problem with TG2 and formencode. I have a set of three
checkboxes. These three are fairly static (i.e. no items will be added
to that list). So I don't see the point of creating a form-widget, and
rather hard-code it into HTML. But how should I name the form elements
so that formencode handles them properly? Additionally: which
validator should I use for a checkbox list? validators.Set? Or is
there something else?

I've seen in the docs, that fields which can take multiple values
should be named "item-1", "item-2", ... , "item-n". I tried this like
the following, but it didn't work:

<input type="checkbox" name="foo-1" value="23" />
<input type="checkbox" name="foo-2" value="42" />
<input type="checkbox" name="foo-3" value="64" />

I'd like this to feed the following controller-method:

@validate( validators={ "foo": validators.Set() } )
def my_foos( self, foo=None ):
   pass

Or something along those lines.

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to