• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5799: Checkbox values are not applied after POST (TSA trunk bug)

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine TSA Urgent Closed   major 5.0.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

I tried to set some values when reporting Item5798, but they simply don't apply. Probably it is related to TSA code. I need a test environment to solve this (unfortunately, I don't have one now).

The affected values are those from checkboxes. Radio buttons, text inputs, text areas and selects works well.

-- TWiki:Main/GilmarSantosJr - 21 Jul 2008

Investigating this issue, I find the problem within TWiki::Engine::CGI::prepareBodyParameters:

sub prepareBodyParameters {
    my ( $this, $req ) = @_;

    return unless $ENV{CONTENT_LENGTH};
    my %p = $this->{cgi}->Vars;
    while ( my ( $key, $value ) = each %p ) {
        $req->bodyParam( -name => $key, -value => $value );
        $this->{uploads}->{$key} = 1 if scalar $this->{cgi}->upload($key);
    }
}

According to CGI.pm man page:

When using this(CGI::Vars), 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.

So the fix is to call $req->bodyParam this way:

$req->bodyParam( -name => $key, -value => [ split /\0/, $value ] );

-- TWiki:Main.GilmarSantosJr - 22 Jul 2008

Cleaned "WaitingFor" field.

-- TWiki:Main.GilmarSantosJr - 10 Aug 2008

ItemTemplate
Summary Checkbox values are not applied after POST (TSA trunk bug)
ReportedBy TWiki:Main.GilmarSantosJr
Codebase ~twiki4
SVN Range TWiki-5.0.0, Mon, 21 Jul 2008, build 17093
AppliesTo Engine
Component TSA
Priority Urgent
CurrentState Closed
WaitingFor

Checkins TWikirev:17095
TargetRelease major
ReleasedIn 5.0.0
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2008-08-10 - GilmarSantosJr
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback