[Zope] how to select selected optoin: newbie
Jeremy Tammik
jeremy@redcor.ch
Mon Aug 4 08:34:23 EDT 2003
On Monday 04 August 2003 09:09, Jase Oldham wrote:
> Hi,
>
> Ive been trying to make this select list auto select
> the request variable.
>
> <SELECT name="country">
> <OPTION tal:repeat="world
> here/getCountryMethod" tal:attributes="value
> world/country" tal:content="world/country"></OPTION>
> </SELECT>
>
> ZSQL = getCountryMethod ( select * from world
> ZPT = index_html
>
> I have a form which submits a select option to zsql
> which then goes to index_html where i want the select
> to selected the variable in request that was sent.
>
> Hope this is clear.
>
> Jase
>
hi jase,
i use something like the following to set the 'selected' attribute
using tal:attributes for the option i want to preselect:
<tr>
<td i18n:translate="">Language</td>
<td tal:define="selected sc/language | nothing">
<select name="language">
<option>*: Any</option>
<option tal:attributes="selected python:selected and
selected[0]=='D'">D: Deutsch</option>
<option tal:attributes="selected python:selected and
selected[0]=='E'">E: English</option>
<option tal:attributes="selected python:selected and
selected[0]=='F'">F: Francais</option>
<option tal:attributes="selected python:selected and
selected[0]=='I'">I: Italiano</option>
</select>
</td>
</tr>
cheers
jeremy
More information about the Zope
mailing list