DNNDev.com Forums Minimize
How do I preserve line breaks from textarea fields?
Last Post 27 Sep 2010 02:29 AM by Steve Bright. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
wiredkiwi
New Member
New Member
Posts:38
Avatar

--
22 Apr 2010 12:35 PM  
So I've got text entered in a textarea field, how do I preserve the line breaks when showing in a template? the <xmod:format/> tag doesn't seem to do the trick...
KnowBetter Administrator
New Member
New Member
Posts:96
Avatar

--
22 Apr 2010 02:54 PM  
Use the CSS "white-space:pre;" rule.
Steve Bright
New Member
New Member
Posts:4
Avatar

--
29 Jul 2010 09:48 AM  
"white-space:pre" doesn't allow the text to wrap, so it's not useful for longer text. "white-space:pre-wrap" works, but not on some older browsers (http://www.quirksmode.org/css/whitespace.html). I've searched the forums for a solution to the linebreak problem but can't find a solution. In XMod there is a "preservelinebreaks" property, but I can't find an equivalent in XMod Prod. Presenting users with the HtmlInput control to solve the problem is asking for trouble.

Can anyone provide the solution to this common scenario?
Steve Bright
New Member
New Member
Posts:4
Avatar

--
27 Sep 2010 02:29 AM  
Kelly replied with this solution:

<xmod:Format Type="Regex" Pattern="\n" Replacement="<br />" value='[[Synopsis]]' />

This solution works. One helpful note: Windows text files use \r\n to terminate lines, while UNIX text files use \n. I haven't noticed a difference in results between the two patterns with DNN database.
You are not authorized to post a reply.

Active Forums 4.1
spacer
dummy