[Twisted-web] Multiple submit buttons with formless

Dave Cook daverz at gmail.com
Sun Apr 10 18:42:48 MDT 2005


First my question: is there an alternate way to do multiple submit
buttons with formless than adding annotate.Button()'s?  Maybe the
annotate.List or Group stuff, whatever those do?  I'm hoping someone
will say, "You idiot, you don't just do it by sticking more Button()s
in."

I ask, because ButtonRenderer is broken, and has been broken for a
while, and I can't imagine that people have only needed one button. 
It's broken because there are no 'name' attributes in the <input> tag,
and thus no way to distinguish the buttons.

There are several ways to fix this: patch the code (submitted to
issues by me and others), "patch" the ButtonRenderer class like

    ButtonRenderer.rend = lambda c, d:  input(type='submit', value=d.label,
                                                                      
          name=d.name, id=keyToXMLID(c.key))

or create your own renderer (code attached).  Yet another way is to do
your own layout and get the button info from request.args (example
stan attached).

Hope this will be helpful to somebody, I'm still groping my way through this.

Dave Cook
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myrenderers.py
Type: application/octet-stream
Size: 1017 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20050410/5a7b56f2/myrenderers.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: baseformstan.py
Type: application/octet-stream
Size: 3740 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-web/attachments/20050410/5a7b56f2/baseformstan.obj


More information about the Twisted-web mailing list