OPTGROUP support

19 views
Skip to first unread message

DenesL

unread,
Mar 21, 2008, 9:02:18 PM3/21/08
to web2py Web Framework
I just noticed that OPTGROUP is not in html.py; should it be?.

Massimo Di Pierro

unread,
Mar 21, 2008, 9:24:48 PM3/21/08
to web...@googlegroups.com
I try to keep the list of helpers to a minimum since users can define
their own. Do people really use OPTGROUP frequently?

Massimo

DenesL

unread,
Mar 21, 2008, 10:01:14 PM3/21/08
to web2py Web Framework
> ... users can define their own...

True, but this case requires the modification of the standard SELECT.

> Do people really use OPTGROUP frequently?

Good question.

The code for OPTGROUP is almost a copy of SELECT but it does not work
with the current SELECT:

class OPTGROUP(DIV):
"""
NOTE: this does not work with the current SELECT helper
"""
tag='optgroup'
def postprocessing(self):
components=[]
for c in self.components:
if isinstance(c,OPTION):
components.append(c)
else:
components.append(OPTION(c,_value=str(c)))
if self.attributes.has_key('value') and \
self.attributes['value']!=None and \

self.attributes['value']==components[-1].attributes['_value']:
components[-1].attributes['_selected']=ON
self.components=components
Reply all
Reply to author
Forward
0 new messages