PHPTAL
Posted: Tue Dec 19, 2006 3:00 pm
So yes I am using PHPTAL for templating and it is working out quite well for me.
The problem I have is trying to have a select option pre selected when populating the options dynamically. Like this:
How would I go about making a conditional attribute? I have tried things like this:
but that gives me the error that state/Id does not exist or whatever. I searched google and the mailing list stuff to no real solution. Anyone know how this could be accomplished?
The problem I have is trying to have a select option pre selected when populating the options dynamically. Like this:
Code: Select all
<select name="fkStateId">
<option value=""></option>
<option tal:repeat="state States" tal:attributes="value state/Id" tal:content="state/State">
</option>
</select>
Code: Select all
<select name="fkStateId">
<option value=""></option>
<option tal:repeat="state States" tal:attributes="value state/Id; selected php: state/Id == SelectedState ? 'selected' : ''" tal:content="state/State">
</option>
</select>