facebook

how to add a newline to a textarea?

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #229457 Reply

    Frank
    Member

    Hello,

    I am stumped.
    I have a database that has a record for each line in a document.
    There is a field that has a value to indicate how many blank lines to insert before writing the document line.

    I want this to be a web application, but want text only, no html.
    I found an editor at http://www.blueshoes.org that will allow text only.

    My problem is I cannot get the textarea to format with the line spacing.

    I tried

    doc = doc + document_line + ‘\n’;

    <textarea>
    <%=doc%>
    </textarea>

    This is not working.
    Can someone with more knowledge help me?

    Thanks
    Frank

    #229467 Reply

    Riyad Kalla
    Member

    Frank if you are trying to display this text in a webpage, then your newline char needs to be an html new line “<br>”, \n only makes sense in the contexts of Java applications.

    #229468 Reply

    Frank
    Member

    ok, thanks
    Then I would need a way to strip the html before writing the document back to the database.
    Are there any routines to do this?
    I thought the editor from blueshoes would just do text.

    Regards,

    Frank

    #229472 Reply

    Riyad Kalla
    Member

    Hard to say, you could look for a regular expression to do it, depending on how much control you have over the HTML, you could simply parse it out yourself.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: how to add a newline to a textarea?

You must be logged in to post in the forum log in