On Tue, Jul 20, 2004 at 02:56:03PM -0700, Roderick A. Anderson wrote:
> I'm starting to create a some code that begs to be handled by TT (or
> perl). I can do it in the CGI script but I'd like ot try out this new
> tool -- TT2.
>
> Here's what I'm not liking using TT2.
>
> <input type="radio" name="keepdays" value="3" [% IF keepdays = 3 %]
> checked="checked" [% END %]/>3
> <input type="radio" name="keepdays" value="7" [% IF keepdays = 7 %]
> checked="checked" [% END %]/>7
> <input type="radio" name="keepdays" value="14" [% IF keepdays = 14 %]
> checked="checked" [% END %]/>14
> <input type="radio" name="keepdays" value="30" [% IF keepdays = 30 %]
> checked="checked" [% END %]/>30
>
> Seems to me there should be some ultra-slick TT2 method to do this but it
> escapes me -- even with the Badger book at hand. Is there some already
> defined method to do this?
Something like this perhaps:
[% days = [ 3, 7, 14, 30 ] %]
[% FOREACH day IN days -%]
<input type="radio" name="keepdays" value="[% day %]"
[%- IF keepday == day %] checked="checked"[% END %]/>[% day %]
[% END %]
hth,
Dave...
--
We are far too young and clever
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates