r5 - 13 Feb 2005 - 16:10:07 - SamHaslerYou are here: TWiki >  Codev Web > FormfieldGetsNotShortended
Tags:
, create new tag

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 | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r5 < r4 < r3 < r2 < r1 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo