[Zope3-Users] Re: vary formlib render_submit_button by skin

Philipp von Weitershausen philipp at weitershausen.de
Thu Apr 19 09:17:56 EDT 2007


Aleksander Kowalczyk wrote:
> On 4/19/07, *Marius Gedminas* <mgedmin at b4net.lt 
> <mailto:mgedmin at b4net.lt>> wrote:
> 
>     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).
> 
> 
> Can I somehow override this directive (from formlib/configure.zcml) in 
> my instance's etc/overrides.zcml ?
>   <adapter factory=".form.render_submit_button" name="render" />

Sure you can. That's what ZCML overrides are for.


-- 
http://worldcookery.com -- Professional Zope documentation and training



More information about the Zope3-users mailing list