[Zope] Templates and Attributes

Colin Fox cfox@crystalcherry.com
15 Mar 2002 19:30:02 -0800


--=-sQ4JA9IwuDW2DZ7xbNv1
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hello, everyone.

I'm trying to create a page for editing a database entry.

The form I'm using has a pair of radio buttons for a person's gender.
I'm using the page template's tal:attribute feature to set the default
values of all the text input fields, and that works great.

But I can't figure out how to do this with the radio buttons, since they
don't use the format 'value=3D"CHECKED"', they simply use 'CHECKED'. The
tal:attribute command seems to want the 'field=3Dvalue' format, which HTML
doesn't want.

Here's a line from my template page:

<td>
   <input type=3D"radio" name=3D"gender" value=3D"M"
               ischecked
               tal:attributes=3D"ischecked
python:here.checkbox_test(here.gender,'M')"
               tabindex=3D"3"> Male</td>

I tried to trick it with an artificial 'ischecked' flag (hoping it would
simply be replaced), but I end up with 'ischecked=3D"CHECKED"'.

Has anyone done this, or can anyone point me to some code that does it?
I haven't found any examples or tutorials yet that describe this
specific problem.

TIA!

--=20
Colin Fox                                       cfox@crystalcherry.com
CF Consulting Inc.                                    GPG Fingerprint:
                    D8F0 84E7 E7CC 5C6C 9982  F1A7 A3EB 6EA3 BC97 572F

--=-sQ4JA9IwuDW2DZ7xbNv1
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA8krw6o+tuo7yXVy8RAheRAKC5MO3HarKonFkhUul1/9+NHVbqtACeMx2d
4IO+cQTbzXhnkYzauDCN+7g=
=9sXY
-----END PGP SIGNATURE-----

--=-sQ4JA9IwuDW2DZ7xbNv1--