Love this idea! Here is a slightly improved dropdown renderer I wrote. It
adds the capability to give classes to select options, so that you can use
this jquery plugin: http://www.appelsiini.net/projects/chained
That plugin lets you set up multiple dropdowns so that when you select one,
the next one gets populated with certain options depending on which one you
picked.
def render(self):
attrs = self.attrs.copy()
attrs['name'] = self.name
classDefined = False
selectionMade = False
x = '<select %s>\n' % attrs
for arg in self.args:
if isinstance(arg, (tuple, list)):
if len(arg) == 3:
classDefined = True
HTMLclass, value, desc = arg
if len(arg) == 2:
value, desc = arg
else:
value, desc = arg, arg
if self.value == str(value) and selectionMade == False:
select_p = ' selected'
selectionMade = True
else: select_p = ''
if classDefined == True: class_p = ' class="%s"' %
net.websafe(HTMLclass)
else: class_p = ''
x += ' <option%s value="%s"%s>%s</option>\n' % (class_p,
net.websafe(value), select_p, net.websafe(desc))
classDefined = False
x += '</select>\n'
return x
On Tuesday, May 14, 2013 4:12:51 PM UTC-4, Tae Sandoval Murgan wrote:
>
> I was thinking the same thing. I want to make some improvements to the
> Form class, but first I wanted to communicate with Anand on the open issues
> because some of them are related to what I want to do. So, I'm willing to
> help, but my concerns are that I'm new to Python and I have just used
> frameworks, I have never involved on developing or maintaining one, so some
> stuff is magic for me. Besides that I'm happy to know that more people
> wants to continue the Aaron's work.
>
> Cheers from Chile, and please, excuse my English.
>
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/webpy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.