[ZPT] select, option, selected in ZPT?
Fabiano Weimar dos Santos
fabiano@x3ng.com.br
19 Jun 2002 12:05:39 -0300
--=-ZVp1ZReC4rHpD9TnF7Gw
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hy Jim
try this code
<select tal:repeat=3D"op python:here.select_options()">
<option tal:content=3D"op/option_text"
tal:attributes=3D"value op/option_value;
selected python:test(op.option_value=3D=3Drequest.value_from_post,
'selected', '')"></option>
</select>
Where i find this sintaxe ??? XHTML is THE WAY !!!
Em Qua, 2002-06-19 =E0s 10:55, Jim Kutter escreveu:
> Hi Folks
>=20
> I'm trying to figure out how to retain form data after a post (in the eve=
nt of an error of some sort) so I fill in the values of the form with what =
was passed. For example, a registration process that must do a DB query and=
return the same form if the username is already taken so the user can pick=
another without filling out the whole thing again.
>=20
> How would I add the "selected" attribute to an <option> html tag in zpt? =
Does the tal:attribute method work? If so, wouldn't I need to tell it what =
attribute to assign a value to?
>=20
> Basically I want to do this in pseudocode
> while (dropdown)
> if dropdown[n] =3D=3D options.dropdown_from_post:
> <option "selected">Blah</option>
> else:
> <option>Blah not selected</option>
>=20
> Thanks
>=20
> -jim
--=20
Fabiano Weimar dos Santos (Xiru) <fabiano@x3ng.com.br>
X3ng Web Technology <http://www.x3ng.com.br>
--=-ZVp1ZReC4rHpD9TnF7Gw
Content-Type: application/pgp-signature; name=signature.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Para mais informações veja http://www.gnupg.org
iD8DBQA9EJ3DTqbDpNXhEbERAiZJAKCDU5IjJFglfXtkeA+GQdUNkJGYtQCgpja8
ffdRF6reOSLHmhclKTtMmQU=
=oVIU
-----END PGP SIGNATURE-----
--=-ZVp1ZReC4rHpD9TnF7Gw--