Hi all;
I was trying to start using web.form; but i just found a problem with
form.Button.
If i want to use an image on a button (something like <button><img
src="sent.jpg"></button>) i can't, using web.py?
Neither the description nor value attrs work. The func in
/usr/lib64/python2.5/site-packages/web.py-0.32-py2.5.egg/web/form.py
is defined as
class Button(Input):
def __init__(self, name, *validators, **attrs):
super(Button, self).__init__(name, *validators, **attrs)
self.description = ""
def render(self):
safename = net.websafe(self.name)
x = '<button name="%s"%s>%s</button>' % (safename,
self.addatts(), safename)
x += self.rendernote(self.note)
return x
I can use my own Button class using something like
>>> class MyButton(web.form.Button):
... def __init__(self, name, *validators, **attrs):
... super(web.form.Button, self).__init__(name, *validators,
**attrs)
... def render(self):
... safename = web.net.websafe(self.name)
... if self.description:
... x = '<button name="%s"%s>%s</button>' %
(safename, self.addatts(), web.net.websafe(self.description))
... else:
... x = '<button name="%s"%s>%s</button>' %
(safename, self.addatts(), safename)
... x += self.rendernote(self.note)
... return x
Or hack it in the form.py file, but i want to know if it's a bug or it's
a feature to know what to do
Thank you all!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---