Was wondering if there was a better way to deal with radio buttons &
selection box in phptal.

One way, is make an array, and pass it the choices to the template.

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

<option value="">Choose Time</option>
<span tal:condition="exists: post/best_time_to_call">
<option tal:condition="php: post['best_time_to_call'] EQ 'Morning'"
selected="selected" value="Morning">Morning</option>
<option tal:condition="php: NOT post['best_time_to_call'] EQ 'Morning'"
value="Morning">Morning</option>
<option tal:condition="php: post['best_time_to_call'] EQ 'Evening'"
selected="selected" value="Evening">Evening</option>
<option tal:condition="php: NOT post['best_time_to_call'] EQ 'Evening'"
value="Evening">Evening</option>
</span>
<span tal:condition="not: exists: post/best_time_to_call">
<option value="Morning">Morning</option>
<option value="Evening">Evening</option>
</span>
</select>

Best regards,
Levi

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to