Forum Moderators: open
I tried to use a replace statement when getting the field but have had no luck with it:
ARCHIVE_EVENT = Replace(Info("archive_event"),Chr(13), Chr(10) & Chr(13))
Any help would be greatly appreciated.
Place on the <head> something like this:
<%
dim textarea
textarea = rs("textarea")
Function CR(string)
CR = Replace(string, vbcrlf,"<br>")
End Function
%>
Place on <body> this:
<%=cr(textarea)%>
------------------------
hope it helps
I am sure there are easier ways to do it, but this one has worked for me.
Anyway, I usually use this:
ARCHIVE_EVENT = Replace(Info("archive_event"),Chr(10), "<br>")
Since Chr(10) is the part of the newline that always appears, even if the text has been copied and pasted from a dodgy Word-processor (you can just ignore the Chr(13)). NB I can't actually find an example of this so I could have them the wrong way round - it could be Chr(13) you need to use, you'll have to test it. I usually just use vbnewline for readablity anyway (but this fails with the dodgy pasted text)
Also this code can fail if the field is null, so I always use a standalone function which tests whther or not the field is null first.
Hope that makes sense.
IF strComments <> "" THEN
strComments = Replace(strComments, vbCrLf, "<br>")
END IF
If you don't check for "" then you get an error on your replace if the field is empty.
And since you're manipulating the field a few times it's better to put the field into a holder and then manipulate the holder rather than accessing rs("COMMENTS") several times.