Feels strange replying again, but I thought about it for a bit and using Javascript sucks, so here's a slightly different take on doing it with the template.
use HTML::Template; my $tmpl = q{ <TMPL_LOOP NAME=OPTIONS> <option value="<TMPL_VAR NAME=VALUE>" <TMPL_VAR NAME=SELECTED> +><TMPL_VAR NAME=TEXT></option> </TMPL_LOOP> }; my @options = (); for (0..5) { push @options, { VALUE => $_, SELECTED => $_ == 3 ? 'selected' : '', TEXT => { 0 => ' any', 1 => ' one day', 2 => ' two days', 3 => ' three days', 4 => ' four days', 5 => ' one week', }->{$_}, }; } my $t = HTML::Template->new(scalarref => \$tmpl); $t->param(OPTIONS => \@options); print $t->output;
gav^
In reply to Re: SELECT pop-up menus in HTML::Template
by gav^
in thread SELECT pop-up menus in HTML::Template
by George_Sherston
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |