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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP text area problem

Status
Not open for further replies.

TRACEYMARYLAND

Programmer
May 21, 2004
370
US
hi i have textarea and i allow user to type in so for example i have

line1
line2
line3
line4

In database i see just line1 when i do delete after the line 1 i see line2 comes in....so it must have a carriage return in the data.

So now i did to display it
What i want to do is just display in not inside of text area so that user can print this out.

<%widthArea = rs("FIELDNAMESIZE")

I tried this
widthArea = Replace(widthArea, vbCrLf,"<br>")
but it came out blank.

What i had before is this so if the text is greater than
my width then it just loops around.

It be nice if i can just loop around when i get a carriage return but i could not get the above to work.

longtext = ""
i = ""
txt = ""
longtext = rs("FIELD_TEXT")
if len(longtext) > 0 then
for i = 1 to len(longtext) step (widthArea - 5)
txt = mid(longtext, i, (widthArea - 5) )
Response.write txt & "<BR>"
next
end if

Any ideas.
 
You may find that

Code:
widthArea = Replace(widthArea, chr(13),"<br>")

works better, as I think that the textarea only puts a carriage return and not a linefeed as well.
 
if you're just printing it to page and want to keep the formatting :

Response.Write Server.HTMLEncode(rs("FIELDNAMESIZE"))

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
" I always think outside the 'box', because I'm never inside the 'loop' " - DreX 2005
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top