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 not get shortended in $formfield(name, 10, ...) of formatted search

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

Topic revision: r5 - 2005-02-13 - SamHasler
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by PerlIdeas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.