[Zope3-Users] vary formlib render_submit_button by skin

Marius Gedminas mgedmin at b4net.lt
Thu Apr 19 07:08:51 EDT 2007


On Thu, Apr 19, 2007 at 11:20:07AM +0200, Aleksander Kowalczyk wrote:
> I think I have similar problem with action renderer: I would like to attach
> a javascript handler for my action button.
> Unfortunately the renderer seems to not allow to pass any additional
> attributes for the html button (like onclick attribute).

Yes.  I recently needed to add a CSS class to an action button (in Zope
3.2 -- there's no time to port to 3.3/3.4 because Customers Demand
Features).  In the end I subclassed zope.formlib.form.Action and made
render a regular method that did what I wanted it to do.

> Leonardo,
> you mentioned about overriding the renderer adapter. This could also solve
> my problem, if possible. How to do that?

Reading zope/formlib/namedtemplate.txt might help.  You either have to
use ZCML overrides, or subclass zope.formlib.form.Action (or
attach marker interfaces to its instances, although that might not work
given its copy-on-__get__ descriptorish behaviour).

I must be missing something, because for the life of me I cannot see any
point to zope.formlib.namedtemplate.  What does it give you that
subclassing and changing the render method/attribute doesn't?

Marius Gedminas
-- 
There are a lotta computer languages out there doing drugs.
		-- Larry Wall
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20070419/85b28302/attachment.bin


More information about the Zope3-users mailing list