Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submit buttons lost value attribute #3

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

Submit buttons lost value attribute #3

bigjust opened this issue Oct 26, 2009 · 3 comments

Comments

@bigjust
Copy link

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
Copy link
Author

bigjust commented Oct 26, 2009

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

@anandology
Copy link
Member

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
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants