[Zope] how to select selected optoin: newbie

Jase Oldham jaseoldham89@yahoo.co.uk
Tue Aug 5 01:49:20 EDT 2003


Chris/Jeremy,

Thanks so much. The final code is below-there was a
small typo with a redundant tal: item.

<SELECT name="country">
<OPTION tal:repeat="world here/getCountryMethod"
        tal:attributes="selected
python:world.country==request.get('country')" 
        tal:content="world/country">
</OPTION>
</SELECT>

The python i see here accesses the db and iterates
through the list (tuples?) and sets the selected to
the equiv request value via the ==request.get 

Is that correct? im a bit new to python tal and zope.

Jase


 --- Chris Withers <chrisw@nipltd.com> wrote: > Jeremy
Tammik wrote:
> 
> >>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.
> 
> <SELECT name="country">
> <OPTION tal:repeat="world here/getCountryMethod"
>          tal:attributes="selected
> python:world.country==request.get('country')" 
> 
>          tal:content="world/country"
>          tal:></OPTION>
> </SELECT>
> 
> cheers,
> 
> Chris
>  

________________________________________________________________________
Want to chat instantly with your online friends?  Get the FREE Yahoo!
Messenger http://uk.messenger.yahoo.com/




More information about the Zope mailing list