![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3
![]() |
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.
__________________
Quote:
|
|
|
|
|
|
|
#2 |
|
Newbie
Join Date: Jul 2006
Location: In front of my computer
Posts: 6
Rep Power: 0
![]() |
Did you use breaks in the code?
|
|
|
|
|
|
#3 |
|
Expert Programmer
|
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.
__________________
|
|
|
|
|
|
#4 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 333
Rep Power: 3
![]() |
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.
__________________
Quote:
|
|
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#6 |
|
Hobbyist Programmer
Join Date: Apr 2006
Posts: 155
Rep Power: 3
![]() |
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>.
__________________
-- v0id
Last edited by v0id; Jul 31st, 2006 at 12:35 PM. |
|
|
|
|
|
#7 |
|
Expert Programmer
|
@kruptof sorry i didnt realize that. i thought it was a webpage the you needed only single line returns in.
__________________
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C# corruption!!! | Kilo | C++ | 32 | May 21st, 2006 9:44 PM |
| Help with this. Can you check what's missing? | DBZ | C++ | 2 | Mar 18th, 2006 12:39 AM |
| newline in javascript | Intimidat0r | JavaScript and Client-Side Browser Scripting | 4 | Jan 29th, 2006 2:03 PM |
| Error in checking for newline | aznluvsmc | C | 7 | Aug 25th, 2005 6:13 AM |
| Textarea, PHP & MySQL | stakeknife | PHP | 1 | Apr 4th, 2005 9:31 AM |