[Zope] Using ZPT with options/radio/checkboxes
Ron Bickers
rbickers-expires-1060840807.1b24c7 at logicetc.com
Thu Aug 7 02:59:34 EDT 2003
> -----Original Message-----
> From: zope-bounces at zope.org [mailto:zope-bounces at zope.org]On Behalf Of
> Ron Bickers
> <input type="radio" name="required" value="1" tal:attributes="checked
> python:path('request/required | nothing') == '1'" /> Yes
> <input type="radio" name="required" value="0" tal:attributes="checked
> python:path('request/required | nothing') == '0'"/> No
As a follow up to this for checkboxes...
The following should work even though it doesn't test the value, since (as I
mentioned) checkboxes will only be there if they're checked.
<input type="checkbox" name="likespizza" value="1" tal:attributes="checked
request/likespizza | nothing" />
If you have a :list of checkboxes, you could use the following:
<input type="checkbox" name="toppings:list" value="Pepperoni"
tal:attributes="checked python:'Pepperoni' in path('request/toppings |
python:[]') /> Pepperoni
<input type="checkbox" name="toppings:list" value="Mushroom"
tal:attributes="checked python:'Mushroom' in path('request/toppings |
python:[]') /> Mushroom
<input type="checkbox" name="toppings:list" value="Green Pepper"
tal:attributes="checked python:'Green Pepper' in path('request/toppings |
python:[]') /> Green Pepper
These are the cleanest ways I've found to do this. If someone has a cleaner
one, I'd like to know.
_______________________
Ron Bickers
Logic Etc, Inc.
More information about the Zope
mailing list