Hi,

i believe, i've found a bug.. I've upgraded to 2.8.2-stable and have found 
out, that when i edit record using SQLFORM the column with multiple widget 
doesn't update to default values, it is just blank. Here is an example:

SELECT('yes', 'no', _name='selector', _multiple= True, value='|no|', 
requires=IS_IN_SET(['yes', 'no']))

multiple widget ignores default value, at least for me..

I've traced out the problem to html.py, class SELECT, def _postprocessing:

if not value is None:
   if not self['_multiple']:
  ....

else:
 if isinstance(value, (list, tuple)):
   values = [str(item) for item in value]
 else:
    values = [str(value)]
 for c in options: # my patch
    if ((value is not None) and (str(c['_value']) in values)):
       c['_selected'] = 'selected'
    else:
       c['_selected'] = None

The condition str(c['_value']) in values) returns False for some 
reason. str(c['_value']) in str(values)) helped. I've also looked back to 
version 1.78, where values are determined using regexp: values = 
re.compile('[\w\-:]+').findall(str(self['value'])).

 I'm not sure of proper fix, but both variants works for me.

Bye,

Jan


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to