[html-formfu] Populating $form_input with 'select' element options?

Carl Franks fireartist at gmail.com
Tue Nov 8 09:41:30 GMT 2011


On 7 November 2011 18:18, J. Bobby Lopez <jbl at jbldata.com> wrote:
> Thanks very much for this Carl, your insight pointed me in the right
> direction.  It seems there are some caveats in the way I've been
> reading CGI vars which affect multi-valued parameters.
>
> >From http://perldoc.perl.org/CGI.html
> --
> When using this, the thing you must watch out for are multivalued CGI
> parameters. Because a hash cannot distinguish between scalar and list
> context, multivalued parameters will be returned as a packed string,
> separated by the "\0" (null) character. You must split this packed
> string in order to get at the individual values. This is the
> convention introduced long ago by Steve Brenner in his cgi-lib.pl
> module for Perl version 4.

Hi,
You shouldn't be using $cgi->Vars() anywhere near formfu :)
Instead do this:
    my $query = CGI->new;
    $form->query( $query );
before calling process().

This will correctly handle multi-value fields and file uploads.

Carl



More information about the HTML-FormFu mailing list