02-08-2005, 03:06 AM
hey guys, i am having a problem when i insert a record from a textarea box, then preview the record on another page, there are no line breaks when i press enter... i have to manually type in <br> to bring up a line break, can someone please help me with the code. im using ASP VBScript, thanx guys..
02-08-2005, 07:43 AM
02-08-2005, 09:08 AM
where do i place this script? and what do i place in Your string? do i place the name of the textbox?
02-08-2005, 10:08 AM
where do i place this script?
You place it before the code that's displaying
and what do i place in Your string?
You place the value (contents) of the textbox
02-08-2005, 12:41 PM
text areas use plain text formatting not html, so they use vbNewLine or vbCrLf instead of <br> (i prefer using vbNewLine as carriage return line feed means nothing to me .. i dont run my asp on a typewriter :p... maby theres a difference on chillisoft *shrugs*)
ideally you want to save the text as it was in the textarea, however, if you want it reloaded in a textarea you need to use
strTextData = Replace( Replace(strTextFromDB, "&", "&") , "<", "<")so it shows up properly in the textarea.. when this is submitted it needs to be changed back in the reverse order so it is stored properly.. pretty confusing if you do it wrong... which i did :p
to reload it on a normal html page, now it is saved properly, you just need to use Replace(strTextFromDB, vbNewLine, "<br>")
02-08-2005, 05:29 PM
On the page you are displaying the field on, where myString is the field in your database, instead of using <%=rs("myString")%> use
<%=Replace(rs("myString"), vbCrLf, "<br />")%>
02-13-2005, 05:44 AM
thank u so much for all ur help :)