[Zope] Using ZPT with options/radio/checkboxes

Ron Bickers rbickers-expires-1060880100.d0e800 at logicetc.com
Thu Aug 7 13:54:25 EDT 2003


> -----Original Message-----
> From: zope-bounces at zope.org [mailto:zope-bounces at zope.org]On Behalf Of
> Paul Winkler

> > <input type="checkbox" name="toppings:list" value="Pepperoni"
> > tal:attributes="checked python:'Pepperoni' in path('request/toppings |
> > python:[]') /> Pepperoni
> (snip)
>
> well, this is fascinating and very surprising to me.
> I didn't see how your examples could work, until I tried them.

> Apparently, there is some special-casing in ZPT such that "checked"
> and "selected" attributes are handled differently from all others.

Indeed.  I didn't realize this.

Regardless of the attribute, if the expression evaluates to 'nothing', then
it's discarded.  One could accomplish the same as above by doing the
following and there would be no need for special handling of
checked/selected.

<input type="checkbox" name="toppings:list" value="Pepperoni"
tal:attributes="checked python:test('Pepperoni' in path('request/toppings |
python:[]'), 'checked', nothing)" />

Not quite as elegant, but it's not horrible and it behaves as expected, yes?

_______________________

Ron Bickers
Logic Etc, Inc.




More information about the Zope mailing list