• 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.

I got this report by e-mail:

EditTablePlugin will not select items in dropdowns after white space has been added before or after the item text by editing the page directly.

For instance, here the last 3 rows have been changed by page edit:

and in large tables it is not immediately obvious than saving the table will cause data to be lost.

This is a fix which seems to do the job (I added 2 lines):

sub inputElement
{
   ...
   ...
    if( $type eq "select" ) {
        my $expandedValue = &TWiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb );
        $size = 1 if $size < 1;
        $text = "<select$style name=\"$theName\" size=\"$size\">";
        $i = 2;
        while( $i < @bits ) {
            $val  = $bits[$i] || "";
            $valExpanded  = $bitsExpanded[$i] || "";
+           $expandedValue =~ s/^[\s\*]+//;       # Strip of leading white/*
+           $expandedValue =~ s/[\s\*]+$//;       # Strip of trailing white/*
            if( $valExpanded eq $expandedValue ) {
                $text .= " <option selected=\"selected\">$val</option>";
            } else {
                $text .= " <option>$val</option>";
            }
            $i++;
        }
        $text .= " </select>";
        $text .= saveEditCellFormat( $cellFormat, $theName );
   ...

I'm not fluent in Perl smile so I leave it up to you to cook something better.

After saving the data then the extra white space will get lost but that doesn't look a problem. The data isn't lost anymore.

I'm still running 04 Sep 2004 $Rev: 1742 $, Plugin API version 1.025 but I've seen that the latest Dakar still has the same code.

Sorry for not taking the time to follow the "official TWiki" paths to enter this patch (is it a bug? is a fixed bug still a bug? etc.) so I'm passing it entirely to you for better or for worse. smile

-- PTh

  • Remove whitespace from select, radio and checkbox items
  • Restored topic lock if $TWiki::Plugins::VERSION < 1.1

-- PTh

Closed in 4.0.5 KJL

ItemTemplate
Summary EditTablePlugin select drops selected item if cell has whitespace
ReportedBy TWiki:Main.PeterThoeny
Codebase 4.0.4, ~twiki4
SVN Range TWiki-4.1-beta1, Tue, 29 Aug 2006, build 11384
AppliesTo Extension
Component EditTablePlugin
Priority Normal
CurrentState Closed
WaitingFor

Checkins 11392
TargetRelease patch
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2010-05-20 - LisaGroomes
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback