How to get a line feed into a textarea

I am using a web application I have little control over.  Using a web interface, I build a page by filling in a number of standard one-line input fields.  One of these fields will ultimately be displayed in a future page as a textarea object.  I will not be able to have any control such as searching and replacing text in a field as some other solutions recommend.  I need to be able to input something into this input field that when displayed as a textarea object will act as a line feed.  I have tried entering the <BR> tag, but it just gets displayed in the textarea box rather than actually dropping down to the next line.

Seems like a long shot since my hands are somewhat tied, but I thought I would give it a shot.

Thanks,
Kent
LVL 5
CIC AdminAsked:
Who is Participating?
 
Michel PlungjanIT ExpertCommented:
the javascript linefeed is \n
It cannot be entered by hand
Input fields do not accept linefeeds.
If you cannot manipulate the fields before they end up in the textarea, then forget it
0
 
BatalfCommented:
In textareas, you have to use physical linebreaks.

Example:

<textarea rows="5" cols="50">Line 1
Line 2
Line 3
</textarea>

And if you're pulling data from a database, you could convert characters such as <br> into a newline sign (\n) before showing them in the textarea.

Batalf
0
 
CIC AdminAuthor Commented:
Yes, but I don't have access to the code, so I cannot perform any conversions.  I need to be able to enter something in the input text field that will later show up as a line feed when displayed in the text area.  

Still somewhat dubious that this is possible,
Kent
0
 
crackyCommented:
It looks like they are converting your input into HTML entities, so <BR> gets changed to &lt;BR&gt;

It is possible that this also will be converted, but along the lines of what Batalf suggested, you might try to place a carriage return and line feed into your input where you want newlines:

\r\n
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.