Zope Question
Thomas Guettler
newsgroups at thomas-guettler.de
Sun Mar 17 16:39:23 EST 2002
Colin Fox wrote:
> Hi, everyone.
>
> I realize that this isn't the best place to post Zope questions, but hey,
> it's written in python...:)
>
> Anyway, I'm trying to create a form for editing database entries. Part of
> the form includes a pair of radio buttons for gender. I want to seed this
> from with values from the database.
>
> The problem is, radio buttons have a special attribute called 'checked'
> to indicate when they are selected. The Zope page templates allow me to
> alter things of the form ' value="xxx" ', but apparently not where the
> keyword itself is the value. If there was something like
> 'state="CHECKED"', it would be easy. But I can't figure out how to insert
> either CHECKED or nothing depending on the state of a variable.
>
One solution would be to do it like this (I use pseudo-code since I
am new to page templates, and don't want to look up the syntax):
if checked==true
<input type="radio" name="foo" checked="yes">
else
<input type="radio" name="foo">
I know it is not the best solution since you have to type the line twice
but it should work.
thomas
More information about the Python-list
mailing list