I want to set the default value for a scolling list using the contents of an array. I know this should be an easy matter of passing an array ref but it has me flumoxed. When I pass an array with more than 1 value the below code does not work. When I take out the -default altogether a default value still gets set but again only if the country param has one value. Even when I hard code in arrays with more than one value i.e ['gb','ie'] it don't work unless my script is passed 0 params <\p> This is so weird I think I'm doing something really stupid. I'm using CGI::Application and HTML:: Template if it makes any differance.
my $q = $self->query(); my @countrys=$q->param('country'); &CGI::scrolling_list( -name =>'country', -values=>[@CountryCodes], -default=>[@countrys], #fix -size=>5, -multiple=>'true', -labels=>$hashref );
In reply to Set default in scrolling list by hakkr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |