Manual
Manual

Reputation: 1687

message is not displayed on a new line

I am trying to display the message when I make a comment and it is not displaying all the new lines.

so I have a text area

<textarea style="font-family: Arial; font-size: 10px; border: 1px solid ##dddddd; padding: 2px;"></textarea>

and when I make a comment with it , its shows the way its supposed to

text 1 
text 2

this is the output of the message

<div style="padding-top: 2px; padding-left: 10px; height:50px;">
    <font class="text_medium">
    <font color="##555555">
        #message#
    </font>
    </font>
</div>

but when I approve the comment the text shows

text 1 text 2

how do I make my #message# show these new lines that were showing from text area ? thanks in advance

Upvotes: 0

Views: 94

Answers (3)

Mark A Kruger
Mark A Kruger

Reputation: 7193

To give you a ColdFusion specific answer (rather than just CSS) try this:

<div style="padding-top: 2px; padding-left: 10px; height:50px;">
    <font class="text_medium">
    <font color="##555555">
        #paragraphformat(message)#
    </font>
    </font>
</div>

That automatically replaces carraige returns with BR tags.

-mark

Upvotes: 2

Regular Jo
Regular Jo

Reputation: 5510

It's because you're passing as plain text. There are a few things you can do

<pre>#message#</pre>

Or you can use a regex to replace

#REReplace(Message, "\r\n|\n\r|\n|\r", "<br />", "all")#

source: How to replace CR+LF with <br />?

Upvotes: 1

vusan
vusan

Reputation: 5331

Try using pre tag

<div class="text_medium">
    <pre style="color:#555555">
        #message#
    </pre>
</div>

Also suggesting you don't use font as font is HTML5 Deprecated Tag

Upvotes: 1

Related Questions