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

Apparently in an attempt to protect against newlines or other characters messing up TWiki tables when formfield values are extracted using META{formfield...}, the value stored in the formfield is altered (newlines are replaced by <br />, vertical bars are replaced by their code, etc.).

However, when using these fields in a context where these characters are not causing problems, this rewriting results in that bullet lists or tables in form fields are not rendered correctly.

Suggestion: add an option to META{formfield...}, say raw, which does not do this protective rewriting, as in this patch:

*** /e/www/twiki-dakar-4.0.2/lib/TWiki/Render.pm~   Sat Jul  1 22:06:05 2006
--- /e/www/twiki-dakar-4.0.2/lib/TWiki/Render.pm   Sun Jul  2 22:06:16 2006
***************
*** 216,225 ****
      my $text = '';
      my $name = $attrs->{name};
      $text = renderFormFieldArg( $meta, $name ) if( $name );
!     # change any new line character sequences to <br />
!     $text =~ s/\r?\n/ <br \/> /gos;
!     # escape "|" to HTML entity
!     $text =~ s/\|/\&\#124;/gos;
      return $text;
  }
  
--- 216,228 ----
      my $text = '';
      my $name = $attrs->{name};
      $text = renderFormFieldArg( $meta, $name ) if( $name );
! ### TW: Add "raw" option
!     unless ( $attrs->{raw} ) {
!       # change any new line character sequences to <br />
!       $text =~ s/\r?\n/ <br \/> /gos;
!       # escape "|" to HTML entity
!       $text =~ s/\|/\&\#124;/gos;
!     }
      return $text;
  }
  


VarSEARCH has newline parameter that can be set to \n or %BR% or any other string depending on circumstances.

While there is nothing wrong with a raw parameter imho, perhaps just adding newline and verticalbar parameters to both META and SEARCH instead would be more versatile (at the same time keeping them feature-aligned)? These are the two chars causing the most trouble (though for XML purposes &, <, > and " comes nearly as close :-)).

(The newline parameter to SEARCH is implemented, but doc is missing, see Item2565).

-- SP

Any other opinions on this?

-- SP

OK. Good idea. I have implemented this and am testing... --TW

Updated doco and checked in.

--TW

There was a link to this from TWiki:Codev.WhatIsIn04x01. I see that there is a simple solution and I see no objections and nothing to discuss at release meetings. I just mark it as done in TWiki:Codev.WhatIsIn04x01.

-- KJL

Headline update for Rel note

KJL

4.1.0 released

KJL

ItemTemplate
Summary Need the ability to protect formfields from being altered during rendering in SEARCH (added NL definition option)
ReportedBy TWiki:Main.ThomasWeigert
Codebase 4.0.2
SVN Range Thu, 29 Jun 2006 build 10750
AppliesTo Engine
Component

Priority Normal
CurrentState Closed
WaitingFor

Checkins 11590
TargetRelease minor
Edit | Attach | Watch | Print version | History: r12 < r11 < r10 < r9 < r8 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r12 - 2007-01-16 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback