Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   HTML / XHTML / CSS (http://www.programmingforums.org/forum27.html)
-   -   TextArea missing newline (http://www.programmingforums.org/showthread.php?t=10870)

kruptof Jul 28th, 2006 3:43 PM

TextArea missing newline
 
when ever the user hits the return key to go onto the next line and they typed their text on the next line and i sumbit that text, that text appears all on the same line,does anybody how to overcome this......i thank you in advance for your replies.

Mr. John Jul 30th, 2006 5:38 PM

Did you use breaks in the code?

crawforddavid2006 Jul 31st, 2006 9:04 AM

go to the code and but <br> where you want to
start a new line(like this).

It will not put a space between like shown.

kruptof Jul 31st, 2006 10:19 AM

crawforddavid2006::since this is a text that is inputted by the user i don't know where the new line will occur...........Mr.John::how do i make the Text area use line breaks......don't you mean multi line......well the text area is multiline......thanks for the help so far.

DaWei Jul 31st, 2006 10:41 AM

Sure you know where the user put a newline. Locate it in the text and replace it with a break or add a break to it. The newline is treated in rendering as just more whitespace. That's why lines wrap to accomodate the width of the page and the text size selected. If you're using PHP to receive the submittal there's even a built-in function (NL2BR if I recall correctly). Otherwise, look at the tools for whatever you're using, or roll your own.

v0id Jul 31st, 2006 12:14 PM

Like DaWei said, you just need to look the input trough for finding linebreaks, you can do this in PHP with the, like DaWei also said, nl2br($variable);
In ASP you have to replace vbCrLf with <br>.

crawforddavid2006 Jul 31st, 2006 1:45 PM

@kruptof sorry i didnt realize that. i thought it was a webpage the you needed only single line returns in.


All times are GMT -5. The time now is 12:24 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC