Dnia 29-06-2008 o 05:56:33 Levi Stanley <[EMAIL PROTECTED]> napisał(a):

Or you can do it like the method below, however I was wondering if there
is a better way than doing it like this?

You could solve it like this:

$phptal->best_times_to_call = array('Morning','Evening');
<option tal:repeat="opt best_times_to_call" tal:attributes="selected php:isset(post['best_time_to_call']) and post['best_time_to_call']==opt" tal:content="opt" />

tal:attributes is smart enough to generate selected and checked attributes properly for XHTML.

<option value="">Choose Time</option>
<span tal:condition="exists: post/best_time_to_call">

BTW: <span> in <select> is not allowed. You should at least add tal:omit-tag="" or best use <tal:block>, which is "invisible".

regards, Kornel

PHPTAL mailing list

Reply via email to