How to insert line break into a TextArea control

Greetings everyone,

This is probably a cheap one, for that I apologize.

I will like to insert a br into a textArea so that when I hit then return key, the next text begins on a new line.
For instance, if I  have the following text:  Hello, World!
I am Christopher Columbus and I discovered America.

I would like "I am Christopher Columbus and I discovered America to start on a new line.

So far, everying is wrapping naturally which is fine but I want to be able to begin a new paragraph on a new line.

Can someone please help?


Comments: <textarea cols="20" rows="8" name="comments" maxlength="200" WRAP="Virtual"> </textarea>

thanks much in advance
nigermanAsked:
Who is Participating?
 
MrRobotConnect With a Mentor Commented:
if the data doesn't contain new lines, it's probably related to your data retrieval page, so you'll have to modify your code on data retrieval to store the data without replacing / removing -line break- characters, and everything will work fine.

good luck
0
 
MrRobotCommented:
hi,

just set the multiline property of the textarea.

fyi; no html elements are used in a text area, when you hit enter a line break character is inserted, instead of a <br>

good luck
0
 
MrRobotCommented:
oh, a text area is always multiline.. so it should already go to the next line when you hit <enter>

just see the comment textarea on this question page source in experts exchange,


        <textarea id="text" name="text" rows="15" cols="60" class="rightEdge"></textarea>

perhaps you have something on your form interfaring with your <enter> key?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
nigermanAuthor Commented:
Well this occurs on details page - the page the displays info you enter on the textArea.

Here is that code and who knows what could be interferring with it.

<table width=100% cellspacing=10 valign=top ID="Table2">
   <tr>
    <td>
             <P align=left><STRONG><FONT face=Arial></FONT></STRONG>&nbsp;</P>
                        <%
                              '... create and open connection ...
                            Set conn = Server.CreateObject("ADODB.Connection")
                             conn.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
                            "DATA SOURCE=" & server.mappath("Database/SThom.mdb")
                            conn.Open
                            id = request("newsID")
                            Set RS = conn.Execute("SELECT details FROM tblAnnouncements WHERE newsID=" & id )
                               Response.Write RS(0)
                            RS.Close
                            conn.Close
                        %>
                                                </p>

      </td>
    </tr>
</table>
0
 
MrRobotCommented:
Ah it's the generation phase of the page. I thought you were refering to runtime when you said 'hit enter'.

So, the code you sent is correct, you don't need to replace -new line- characters with <br> tags when generating a <textarea>, since it already uses -new line-s.  So it looks like the problem is with the recorded values, have you checked the data to see if it has -new line- characters?
0
 
nigermanAuthor Commented:
thank you very much MrRobot.

Sorry for late response.

my kids (2 boys) are in first and second grades and today is their school's fall cleanup day. I had to rush to assist with cleaning up the property, hence the late response.
0
 
MrRobotCommented:
you're welcome nigerman =))
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.