in reply to Re: Re: CGI.pm being funny?
in thread CGI.pm checkbox problem?
The reason for the behavior you are seeing is that @predefined contains an array reference, rather than a plain value. Since you don't show how you defined @predefined, it is impossible to say where you went wrong. Suffice it to say that:
is not the right way to pass values to a CGI method. @predefined will be flattened into the argument list. If @predefined contains a single value, you've lucked out and it will work okay. If @predefined contains an odd number of values, the first will be taken as the value for the -values key, and the rest will be taken as separate key/value pairs. Worst case, if @predefined contains an even number of values, all the remaining explicit key/value pairs will be shifted by one, so that the keys are used as values and vice versa.print $q->checkbox_group ( -name=>'predefined', -linebreak=>'true', -values=>@predefined, -defaults=>param('predefined'), );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: CGI.pm being funny?
by xtype (Deacon) on Feb 06, 2002 at 05:52 UTC | |
by chipmunk (Parson) on Feb 06, 2002 at 19:02 UTC |
In Section
Seekers of Perl Wisdom