[Zope] ZPT and check boxes
Jim Penny
jpenny@universal-fasteners.com
Fri, 31 May 2002 12:36:54 -0400
On Fri, May 31, 2002 at 10:30:23AM +0100, David Kyte wrote:
>
> Hi,
>
> Can anyone suggest how to implement a check box
> in ZPT
>
>
> When I create an edit form from a database I want
> a check box that is either checked or not depending
> on the value in the database
>
>
> I am aware of tal:attributes but need to know how to
> bend it to create HTML like
>
> <input checked type="checkbox" name="UKSC" value="checkbox" >
Like this:
<input type="checkbox" name="UKSC" value="checkbox"
tal:attributes="checked some_boolean_expression">
Note that the checked attribute is optional. This also works
<input type="checkbox" name="UKSC" value="checkbox" checked
tal:attributes="checked some_boolean_expression">
And so does this:
<input type="checkbox" name="UKSC" value="checkbox" checked="1"
tal:attributes="checked some_boolean_expression">
I really do not like the last form, though. In fact,
<input type="checkbox" name="UKSC" value="checkbox"
checked="Holy, sweet babaloo"
tal:attributes="checked some_boolean_expression">
works.
In all cases, the actual output will be something like:
<input type="checkbox" name="UKSC" value="checkbox" checked="checked">
for a checked item, and
<input type="checkbox" name="UKSC" value="checkbox">
for an unchecked item.
Jim Penny
>
> TIA
>
>
> David Kyte
>
>
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>