Editable Textarea

I've got a page on a website I'm developing that contains a textarea.
The textarea will allow users of the site to enter a description of an
item.

When they submit the form that contains the textarea, the textarea and
other form elements data are stored in a database. So far so good.

My problem concerns carriage returns, new lines, line feeds or whatever
else you want to call them :-)

I want them preserved, so when the user wants to edit the description of
the item, the format of the description is displayed exaclty as it was
entered.

The problem is that HTML renders the carriage returns as white space, so
when the database is read and the textarea populated with the
description field, the carriage returns are lost.

I have tried the ASP REPLACE function to replace carriage returns with
<br>, but the code below actually displays all the <br>'s.

<%=Replace(myRecordset.Fields.Item("myField").Value,Chr(13),"<br>")%>

I played around with different combinations of chr(13) and vbcrlf and I
managed to get the textarea to display the description as it was entered
with carriage returns, but upon further testing and editing of the
description, because of the REPLACE function, the number of carriage
returns was doubling each time!

View Replies