Submit buttons lost value attribute #3

Closed
bigjust opened this Issue Oct 26, 2009 · 3 comments

Projects

None yet

2 participants

bigjust commented Oct 26, 2009

Between .32 and .33, submit buttons no longer have text. We use the description variable, but its cleared out on instantiation. I have attached a patch to fix carry the value attribute to the tag rendering,

diff --git a/web/form.py b/web/form.py
index 750fe6f..8cb7a1c 100644
--- a/web/form.py
+++ b/web/form.py
@@ -312,7 +312,8 @@ class Button(Input):
def render(self):
attrs = self.attrs.copy()
attrs['name'] = self.name

  •    return '<button %s>%s</button>' % (attrs, self.description)
    
  •    attrs['value'] = self.value
    
  •    return '<button %s>%s</button>' % (attrs, self.value)
    

    class Hidden(Input):
    """Hidden Input.

bigjust commented Oct 26, 2009

that paste looks ugly i'll fork and send the patch that way

Contributor

In 0.32 name is used as html of the button. Both value and description were ignored.

>>> import web
>>> web.__version__
'0.32'
>>> b = web.form.Button(name="action", value="save", description="Save Changes")
>>> b.render()
'<button name="action" id="action">action</button>'

I think the right way is to take optional argument html.

>>> Button("action", value="save", html="<b>Save Changes</b>").render()
'<button id="action" value="save" name="action"><b>Save Changes</b></button>'
bigjust commented Oct 30, 2009

even that, thanks

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment