On Fri, Apr 16, 2004 at 01:38:30PM -0500, Charles Brandt wrote: > I was wondering if anyone could offer advice or an example (if handy) for > creating a DateWidget using the form2 package. I'm thinking of something > along the lines of 3 SingleSelectWidgets grouped together (each representing > day, month, and year). This lead me to investigate the WidgetList, but I'm > having a hard time understanding how use it. WidgetList is not what you want (it's also broken in the 1.0b1 release). You probably want to subclass from CompositeWidget. Here is a rough outline: class DateWidget(CompositeWidget): def __init__(self, name, value=None, **kwargs): CompositeWidget.__init__(self, name, value, **kwargs) [... argument checking; split value into year, month, day ...] self.add(SingleSelectWidget, "year", value=year, options=[...]) self.add(SingleSelectWidget, "month", value=month, options=[...]) self.add(SingleSelectWidget, "day", value=day, options=[...]) def _parse(self, request): CompositeWidget._parse(self, request) if self.get_error(): return year = self['year'] month = self['month'] day = self['day'] [... error checking ...] self.value = datetime(...) def render(self): return (self.get_widget('year').render() + self.get_widget('month').render() + self.get_widget('day').render())