Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textarea line break

Status
Not open for further replies.

rsshetty

Programmer
Dec 16, 2003
236
US
I searched the forums and was unable to find a solution to this problem of mine.

I take in data through a textarea and display it later in a <td> tag. I am unable to get the new line characters to display.

While displaying the data I have tried

replace(data,VbCrLf,"<br>")
and
replace(data,chr(13),"<br>")

Additional information:
The data is stored in a field of datatype Text in a sql server 2000 database table.
Also, while taking in the user input, data is passed to the database through XML forms.

Any ideas on how I can get new line characters to display?



rsshetty.
It's always in the details.
 
Well I just enclosed the text within <pre> tags and it worked.



rsshetty.
It's always in the details.
 
Using <pre> is an alternative, but it comes with it's own restrictions. Try this:
Code:
[COLOR=red]data = [/color]Replace(data, VbCrLf, "<br>")

The replace function doesn't inherently replace the data, it simply returns a string with the replacements.

---
Marcus
better questions get better answers - faq581-3339
accessible web design - zioncore.com
 
No, that solution did not work. <pre> does the job so I think I'll stick with it for now.

Thanks all the same. [smile]

rsshetty.
It's always in the details.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top