I think it is a bug. Please check this is not already fixed in trunk, if not please open a ticket. thanks for the work of tracking down the problem.
On Sep 7, 4:58 pm, rdmurphy <[email protected]> wrote: > Hi Massimo and web2py team, > Just following up on this issue. If you guys agree it's a bug I can > open a ticket for it. > > Thanks > Ryan > > On Aug 29, 4:03 pm, rdmurphy <[email protected]> wrote: > > > > > > > > > Hi everyone, > > Since it's my first post, I'd like to first say great framework to the > > whole team. I'm really enjoying using it. > > > I think I've found a small bug in the handling of list fields in an > > invalid form. > > I have a list:string field and another required field. > > > When there is only 1 input field and value for the list field and the > > submitted form is invalid (the other field is invalid), the returned > > error form splits my 1 value up into individual characters since it > > assumes the request.var is an array. > > > I've traced it down to sqlhtml in this section around row 1090: > > > if hasattr(field, 'widget') and field.widget and fieldname in > > request_vars: > > if fieldname in self.vars: > > value = self.vars[fieldname] > > ....etc.... > > widget = field.widget(field, value) > > > Then ListWidget exects to be getting an array as the value. > > > So might need a check on the value type if using self.vars, like: > > if field.type.startswith('list:') and isinstance(value, str): > > value = [value] > > > Thanks > > Ryan

