Greetz Not wanting to invent the wheel: ---NOT WORKING CODE--- <select> <span tal:omit-tag="" tal:repeat="item here/SelectBoxData"> <option tal:attributes="value item/value" tal:content="item/text"></option> <option selected tal:attributes="value item/value" tal:content="item/text"></option> </span> </select> ---NOT WORKING CODE--- When loading my template I want to choose the correct value from the select box. That is set the option SELECTED one of the options. Is there a smart implementation or do I have to make a tal:condition thing?? \Oliver
Oliver Marx wrote:
Greetz
Not wanting to invent the wheel:
---NOT WORKING CODE--- <select> <span tal:omit-tag="" tal:repeat="item here/SelectBoxData"> <option tal:attributes="value item/value" tal:content="item/text"></option> <option selected tal:attributes="value item/value" tal:content="item/text"></option> </span> </select> ---NOT WORKING CODE---
When loading my template I want to choose the correct value from the select box. That is set the option SELECTED one of the options.
<select> <span tal:omit-tag="" tal:repeat="item here/SelectBoxData"> <option tal:attributes="value item/value; selected python:item.value==current_value" tal:content="item/text"></option> </span> </select> Should work -- Luca Olivetti Wetron Automatización S.A. http://www.wetron.es/ Tel. +34 93 5883004 Fax +34 93 5883007
Luca Olivetti wrote:
When loading my template I want to choose the correct value from the select box. That is set the option SELECTED one of the options.
<select> <span tal:omit-tag="" tal:repeat="item here/SelectBoxData"> <option tal:attributes="value item/value; selected python:item.value==current_value" tal:content="item/text"></option> </span> </select>
Should work
...or more neatly: <select> <tal:r repeat="item here/SelectBoxData"> <option tal:attributes="value item/value; selected python:item.value==current_value;" tal:content="item/text">Dummy Content</option> </tal:r> </select> cheers, Chris
participants (3)
-
Chris Withers -
Luca Olivetti -
Oliver Marx