Tags:
create new tag
, view all tags

Bug: Formfield does not get Shortended

Can't get the text within a textarea shortended like explained in FormattedSearch.:

$formfield(name, 30, ...)

Form field value, shortended to 30 characters with "..." indication

It cuts off some charakters, but then display the Rest.

Test case

Create a Form with an textarea and place a few sentences within. Get the form into a topic and search after it. When you try to display just a few characters it will place the "..." but then display the rest of the textarea.

Search: FormfieldGetsNotShortended

Fix: Textarea formfield does n...

Number of topics: 1

Environment

TWiki version: 20030201
TWiki plugins:  
Server OS: Linux
Web server: Apache 2.3x
Perl version:  
Client OS: Linux
Web Browser: Mozilla 1.3

-- AndreUlrich - 21 Mar 2003

Follow up

This needs to be analysed, so I'm assigning it to Dakaar.

-- CrawfordCurrie - 20 Jul 2004

Fix record

Fix is now in SVN.

Index: Search.pm
===================================================================
--- Search.pm   (revision 1764)
+++ Search.pm   (working copy)
@@ -1252,11 +1252,11 @@
         $sep = $params[1] if( @params > 1 );
         if( $sep =~ /^\.\.\./i ) {
             # make name shorter like "ThisIsALongTop..."
-            $theText =~ s/(.{$len})(.+)/$1.../;
+            $theText =~ s/(.{$len})(.+)/$1.../s;

         } else {
             # split and hyphenate the topic like "ThisIsALo- ngTopic"
-            $theText =~ s/(.{$len})/$1$sep/g;
+            $theText =~ s/(.{$len})/$1$sep/gs;
             $theText =~ s/$sep$//;
         }
     }

-- PeterThoeny - 21 Oct 2004

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2005-02-13 - SamHasler
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.