arrays in FORM
David Miller
justdave at bugzilla.org
Fri Apr 1 20:34:58 UTC 2005
Albert Ting wrote:
> If I have something like below in a template:
>
> <input type=checkbox name=choices value="1">1
> <input type=checkbox name=choices value="2">2
> <input type=checkbox name=choices value="3">3
> <input type=checkbox name=choices value="4">4
>
> Is there a way to get the data back as an array, something like:
>
> @{$::FORM{'choices'}}
>
> Best I can tell, FORM only holds strings.
$::FORM is deprecated and getting removed (and will probably actually be
gone in 2.20 if we get lucky). Don't use it unless you have an old
enough version of Bugzilla that doesn't have Bugzilla->cgi available.
If you have that old of a Bugzilla, then %FORM holds single strings,
which anything that passed multiple values concatenated together.
%MFORM contains arrays of all of the values for anything that passed
multiple.
If you have Bugzilla->cgi available, you can get multiple values with
something like
my @array = Bugzilla->cgi->param('paramname');
You can of course do:
my $cgi = Bugzilla->cgi;
first and then use $cgi if you want (if the file you're working in
doesn't already do that).
--
Dave Miller http://www.justdave.net/
System Administrator, Mozilla Foundation http://www.mozilla.org/
Project Leader, Bugzilla Bug Tracking System http://www.bugzilla.org/
More information about the developers
mailing list