Item8391: selectmulti is broken because _substituteFieldTokens can't handle multi-valued parameters

pencil
Priority: Normal
Current State: Closed
Released In:
Target Release:
Applies To: Extension
Component: FormPlugin
Branches:
Reported By: Foswiki:Main.DiabJerius
Waiting For:
Last Change By: ArthurClemens
selectmulti form elements only return the first value of a multi-valued list because of an incorrect assumption in _substituteFieldTokens that a parameter can only be single valued.

Here's the offending code in FormPlugin.pm:

    530         $keyValues{$name} = $query->param($name);
...
    535         my $value = $keyValues{$_};
    536         my ( $referencedField, $meetsCondition ) =
    537           _meetsCondition( $name, $value );
    538         if ($meetsCondition) {
    539             $value =~ s/(\$(\w+))/$keyValues{$2}/go;
    540             $query->param( -name => $_, -value => $value );
    541         }

In a scalar context, param() returns the first parameter value. _substituteFieldTokens then performs substitution into that single value and sets the parameter to the result, incorrectly truncating the list.

-- DiabJerius - 16 Jan 2010

I've attached a patch which resolves this issue. It makes two assumptions:

  • A multivalued field is mapped to a comma separated list when interpolated
  • A condition is single valued

-- DiabJerius - 16 Jan 2010

Thanks for the fix. I will give some TLC to the plugin.

-- ArthurClemens - 16 Jan 2010

Fixed with release 1.6.

-- ArthurClemens - 26 May 2010

 

ItemTemplate edit

Summary selectmulti is broken because _substituteFieldTokens can't handle multi-valued parameters
ReportedBy Foswiki:Main.DiabJerius
Codebase 1.0.8
SVN Range 4715
AppliesTo Extension
Component FormPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins TopMenuSkin:655e81b58df5 TopMenuSkin:9de130d6a763 TopMenuSkin:6d78534b764f TopMenuSkin:a1d17d6122d2 TopMenuSkin:d62851272c03
ReleasedIn
I Attachment Action Size Date Who Comment
patchEXT patch manage 1 K 16 Jan 2010 - 20:51 DiabJerius Patch FormPlugin.pm
Topic revision: r9 - 26 May 2010, ArthurClemens
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