On Tue, 1 Mar 2011 14:14:05 -0800
Bill Ward <[email protected]> wrote:

>The issue here is that my database values are all lowercase, but I
>wanted to display a menu in mixed case, and have the currently
>selected value appear in lowercase as well as the value attribute of
>the <option> tag be the lowercase value.

That's the same for me, all DB values are lowercase but the SELECT
lists are mixed case. Here's how I do it. This is a completely
separate TT file which I [% PROCESS %]:

<select name="[%name%]" id="selector_status">
    <option value=""> </option>
[% val = val | lower %]
[% FOREACH type IN status_list %]
    [% ltype = type | lower %]
    <option value="[% ltype %]" [%IF val==ltype; "selected=1"; END %]>
        [% type | ucfirst %]
    </option>
[% END #foreach.type %]
[% val = '' %]
</select>

And it is called like this:

[% PROCESS input/select_status.tt  name = 'title_status'  val =
"$titledata.first.title_status" 
%]

with 'status_list' being a list in the stash grabbed from the DB.


-- 
Kevin Nathan (Arizona, USA)  
http://www.project54.com

Open standards. Open source. Open minds. 
The command line is the front line.
Linux 2.6.34.7-0.7-default
 18:10pm  up 1 day  3:26,  11 users,  load average: 0.06, 0.01, 0.00

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to