-----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@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.