You are here: Foswiki>Tasks Web>Item12075 (02 Dec 2012, GeorgeClark)Edit Attach

Item12075: CGI.pm won't check multivalued params specified in the query string correctly

pencil
Priority: Urgent
Current State: Closed
Released In: 1.1.6
Target Release: patch
Applies To: Engine
Component: FoswikiForm
Branches: Release01x01 trunk
Reported By: MichaelDaum
Waiting For:
Last Change By: GeorgeClark
On a link like this:

http://....edit/web/topic?MyMultivalueCheckboxField=Val1,Val2,Val3

values won't be checked. This has been the case since forever in Foswiki.

This changed behavior breaks a couple of wiki apps badly where you will see the following pattern:

<input type="hidden" name="MyMultiValueCheckboxField" value="%FORMFIELD{"MyMultiValueCheckboxField" topic="SomeOtherTopic"}%" />

That's pretty common.

However this works fine with recent CGI's (I am testing against 3.52):

http://....edit/web/topic?MyMultivalueCheckboxField=Val1&MyMultivalueCheckboxField=Val2,MyMultivalueCheckboxField=Val3

Problem is that Foswiki already did parse the query string and decomposes the values accordingly into a proper list no matter whether values are passed as a comma separated list or using multiple url params one value each.

When Foswiki::Form::Checkbox calls CGI::checkbox_group it does pass the correct values to be checked down the line. CGI then decides to ignore this list.

... unless you add an override => 1 to the call

Patch:

--- lib/Foswiki/Form/Checkbox.pm        (revision 15382)
+++ lib/Foswiki/Form/Checkbox.pm        (working copy)
@@ -138,7 +138,8 @@
         -values     => $this->getOptions(),
         -defaults   => \@defaults,
         -columns    => $this->{size},
-        -attributes => \%attrs
+        -attributes => \%attrs,
+        -override   => 1
     );
     if ( defined $this->{valueMap} ) {
         $params{-labels} = $this->{valueMap};

-- MichaelDaum - 14 Sep 2012

Hmm. This bug seems familiar. It's not Item11666. Item9007/Item9147 perhaps.

Do we need this in Select.pm too?

-- PaulHarvey - 18 Sep 2012

This is marked a release blocker. Does this need to get into 1.1.6? Is the fix safe, Why not check it in.

-- GeorgeClark - 17 Oct 2012

George, please help out on fixing things. Thanks…

-- MichaelDaum - 17 Oct 2012
 

ItemTemplate edit

Summary CGI.pm won't check multivalued params specified in the query string correctly
ReportedBy MichaelDaum
Codebase 1.1.5, trunk
SVN Range
AppliesTo Engine
Component FoswikiForm
Priority Urgent
CurrentState Closed
WaitingFor
Checkins distro:3ca1e6e29e61 distro:41403c9b44d9
TargetRelease patch
ReleasedIn 1.1.6
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:3ca1e6e29e61
Release01x01Checkins distro:41403c9b44d9
Topic revision: r7 - 02 Dec 2012, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy