[ZPT] magic boolean attributes in TAL

Florent Guillaume fg@nuxeo.com
Sun, 17 Mar 2002 02:24:23 +0000 (UTC)


Is the magic behaviour of boolean HTML attributes documented somewhere
apart from the source ?

For the record, you can write::

  <input type="checkbox" name="foo" tal:attributes="checked mybool">

and depending if mybool is true or false, you'll get one of::

  <input type="checkbox" name="foo" checked="checked">
  <input type="checkbox" name="foo">

which is actually very very handy.


This works in HTML mode only, and for the following attributes::

 "compact", "nowrap", "ismap", "declare", "noshade", "checked",
 "disabled", "readonly", "multiple", "selected", "noresize",
 "defer"

Actually http://www.zopelabs.com/cookbook/1007765719 and
http://www.zopelabs.com/cookbook/996076015 stumbled on it but methinks
it needs documenting in help/tales-attributes.stx


HTH,

Florent
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 10  http://nuxeo.com  mailto:fg@nuxeo.com