Skip to main content
Participant
August 28, 2006
Answered

Display html as text in textarea...

  • August 28, 2006
  • 1 reply
  • 541 views
Ive got a textarea on a form, that when submitted I replace the carriage returns with <BR> just before it is save into the database like below....
<cfset comments=Replace(comments,Chr(13),"<BR>","ALL")>

But when retrieving what is saved I want to diplay it in the textarea again, but without the <br>'s. Is there a function I can use to display what's in the textarea as html?

So...instead of this...

Test<br><br>test

...I want this within the text area.....

Test

Test

I tried to reverse my initial replace function but didn't have any luck. Any thoughts or suggestions would be appreciated.

Thanks!
Dustin
    This topic has been closed for replies.
    Correct answer KCPLCF
    That worked thanks.

    1 reply

    Participating Frequently
    August 28, 2006
    Try using chr(10) (newline) instead of chr(13) (carriage return) for both the initial replace(), and the "undo" replace().
    KCPLCFAuthorCorrect answer
    Participant
    August 28, 2006
    That worked thanks.