Formatting text in Memo fields

Results 1 to 2 of 2

Thread: Formatting text in Memo fields

  1. #1
    Join Date
    Dec 1969

    Default Formatting text in Memo fields

    I am having trouble displaying text from a memo field in my database, with the formatting it was entered into the database with! I can add the txt to the memo field in the database where its stored with the correct formatting, but when I display the text on my page the cariage returns are lost. <BR>Ive played around with the format of the txt box and put the txt into paragraph and preformatted but then I lose my textwrap. <BR>So If any on can help disply memo fields which are preformatted, but still with textwrap it would save my life, well not literally, but close. <BR>Andy <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Formatting text in Memo fields

    You have to replace the textarea formatting with HTML formatting before you save to the db.:<BR><BR>strText = Request.Form("TextAreaField")<BR>1)strText = Replace(strText, vbCrLf, "<BR>") <BR>2)strText = Replace(strText , " ", " "+"&nbsp;")<BR>3)strText = Replace(strText , Chr(39),String(2,39))<BR>&#039;&#039;save to db<BR><BR>Just to be sure I added two more lines:<BR><BR>Line one replaces an linebreak, with the <BR> linebreak for HTML<BR>Line two replaces spaces with the &nbsp space for HTML<BR>Line three replaces &#039; (for example in O&#039;Neill) to prevent sytax errors in your update statement. <BR><BR>Now when you get the field from the db, you can simply do an response.write and the linebreaks will be in there ;-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts