hakkr has asked for the wisdom of the Perl Monks concerning the following question:
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 );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Set default in scrolling list
by chipmunk (Parson) on Jan 09, 2002 at 20:50 UTC | |
|
Re: Set default in scrolling list
by Biker (Priest) on Jan 09, 2002 at 19:59 UTC | |
by hakkr (Chaplain) on Jan 09, 2002 at 20:25 UTC | |
|
Re: Set default in scrolling list
by Masem (Monsignor) on Jan 09, 2002 at 20:12 UTC |