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 ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/
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
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
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/
Jase Oldham wrote:
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.
Roughly, yeah :-) Chris
participants (3)
-
Chris Withers -
Jase Oldham -
Jeremy Tammik