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

Attachment: signature.asc
Description: Digital signature

Zope3-users mailing list

Reply via email to