• 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.
When you use a textarea field and enter multiple lines the table breaks once it is saved. e.g.)

%EDITTABLE{format="textarea, 3x10"}%
| foo |
| bar |

Here's a bit of a hack I made to fix this, but I'm sure it can probably be done in a nicer manner.

It basically replaces linefeeds with
when saved and when editing the table the
is replaced with the linefeeds again to make it convenient for the user.

--- EditRowPlugin/TableCell.pm        2007-11-27 16:31:49.000000000 -0800
+++ EditRowPlugin/TableCell.pm        2007-11-27 17:23:56.000000000 -0800
@@ -35,6 +35,13 @@
 sub stringify {
     my $this = shift;

+    my $text = $this->{text};
+
+    # modify to replace linefeeds with breaks to support multiline textareas
+    $text =~ s/[\r\n]+/<br>/g;
+
+    $this->{text} = $text;
+
     return $this->{precruft}.$this->{text}.$this->{postcruft};
 }

@@ -170,12 +177,17 @@
         $rows = 3 if $rows < 1;
         $cols = 30 if $cols < 1;

+       # modify textarea to display multiple lines nicely
+       my $tmptext = $unexpandedValue;
+        $tmptext =~ s/<br>/\r\n/gi;
+        $tmptext =~ s/\%BR\%/\r\n/gi;
+
         $text = CGI::textarea({
             class => 'EditRowPluginInput',
             rows => $rows,
             columns => $cols,
             name => $cellName,
-            value => $unexpandedValue});
+            value => $tmptext});

     } elsif( $colDef->{type} eq 'date' ) {
-- TWiki:Main.JeffCrawford

Thanks Jeff, I took the patch in almost verbatim. Seems to work fine.

-- CrawfordCurrie - 08 Mar 2008

ItemTemplate
Summary Multiline textarea fields break table
ReportedBy TWiki:Main.JeffCrawford
Codebase 4.2.0
SVN Range TWiki-4.3.0, Sun, 25 Nov 2007, build 15790
AppliesTo Extension
Component EditRowPlugin
Priority Normal
CurrentState Closed
WaitingFor

Checkins TWikirev:16489
TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2008-03-08 - CrawfordCurrie
 
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