?
Solved

Replace a carriage return in TEXTAREA with chr(13)?

Posted on 2003-03-23
4
Medium Priority
?
1,970 Views
Last Modified: 2008-02-01
I am making a Web site for a group within my local church, and the leader is fairly computer-ILliterate.  But, he wants a page where he can add content by filling out a form.  I have created a form for him where he can type some text in a TEXTAREA form, PLUS add formatting by clicking button images next to the box.  He clicks a button (for example, the "B" Icon for Bold/UnBold), and the corresponding mark-up is added to the end of the textbox so he can keep typing.  Here's my problem:

When he presses "Return" on his keyboard to make a carriage return, it appears in the text box, but does not transform to whitespace after it is filled out.  In other words, his words before and after the carriage return are stuck together - right next to each other.  Is there a way in ASP or JavaScript to detect the "Enter" key and insert a <br> tag there instead?  Or at least, when he submits it, have a code that replaces all carriage returns with <BR> tags?  Please reply m_r_productions@hotmail.com
0
Comment
Question by:m_r_productions
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
zombeen earned 200 total points
ID: 8193083
i 've not checked the constants, but u can try this
strText = Replace(Replace(request.form("textarea"), vbCrLf, "<br>"),chr(10), " ")

strText =replace(strText,chr(13),"<br/>")

You might hav to check the values for the desired result... but this is the basic concept to do this

Zombeen
0
 
LVL 15

Expert Comment

by:gladxml
ID: 8193141
m_r_productions,

>>>>
Or at least, when he submits it, have a code that replaces all carriage returns with <BR> tags?
>>>>

You can use the replace function...

tmptextarea = Replace(request.form("textarea"), "<br>", "vbcrlf")

Below is related link regarding replace method...

http://www.devguru.com/Technologies/vbscript/quickref/replace.html

HTH...

HAppy programming...
0
 

Author Comment

by:m_r_productions
ID: 8193181
Hey zombeen you hit the nail right on the head.  Good answer, I tried it and it worked very well.  Thank you for the quick response, too.

gladxml had a valid answer, too, except I wasn't replacing the <br> tag with chr(13).  But the answer in itself is still very useful information.  Thanks for responding, gladxml
0
 
LVL 15

Expert Comment

by:gladxml
ID: 8193246
m_r_productions,

Glad to be of help...

Reagrds,
gladxml
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question