[Zope] Design question about HTML select
Geir Bækholt
Geir Bækholt
Sun, 21 Oct 2001 22:52:43 +0200
Hello azbok,
Saturday, October 20, 2001, 22:32:46, you wrote:
[snip]
ayc> 2) I can use ZPT TAL:condition sorta expressions to get the job done.
ayc> My current solution is like this, but I don't like it at all:
ayc> <SELECT NAME="a" TAL:define="ov options/optval">
ayc> <OPTION SELECTED TAL:condition="python:ov == 1">1</OPTION>
ayc> <OPTION TAL:condition="python:ov != 1">1</OPTION>
ayc> <OPTION SELECTED TAL:condition="python:ov == 2">2</OPTION>
ayc> <OPTION TAL:condition="python:ov != 2">2</OPTION>
ayc> <OPTION SELECTED TAL:condition="python:ov == 3">3</OPTION>
ayc> <OPTION TAL:condition="python:ov != 3">3</OPTION>
ayc> </SELECT>
ayc> Is there a better more general solution?
ayc> Thanks greatly for any suggestions
you should be able to do something like:
<untested>
<select name="a" tal:define="ov options/optval;vals python:[1,2,3]">
<option tal:repeat="vals" tal:content="vals"
tal:attributes="value vals;selected python:vals==ov">1</option>
</select>
</untested>
good luck.
:-)
PS : there is also a separate ZPT-mailinglist where you will get
replies top ZPT questions quicker. ( zpt@zope.org )
--
Geir Bækholt web-developer
geirh@funcom.com funcom oslo | webdev-team