Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Paragraph and line breaks in textareas
Old 03-08-2004, 11:41 AM Paragraph and line breaks in textareas
rbmingie's Avatar
Novice Talker

Posts: 5
Trades: 0
Does anyone know how to make paragraph/line breaks display in textarea tags? Text is currently showing up in the results e-mail template like this:

Greetings: some text some text some text some text some text some text some text. some text some text some text some text some text some text some text some text some text some text some text. some text some text:1.some text some text2.some text some text3.some text some text4.some text some textSee ya.Rex

But I want it to show up like this:


Greetings:

some text some text some text some text some text some text some text. some text some text some text some text some text some text some text.

some text some text some text some text. some text some text:

1.some text some text
2.some text some text
3.some text some text
4.some text some text

See ya.

Rex
rbmingie is offline
Reply With Quote
View Public Profile Visit rbmingie's homepage!
 
 
Register now for full access!
Old 03-08-2004, 11:46 AM
Wenslock's Avatar
Webmaster Talker

Posts: 746
Location: Lincoln, UK
Trades: 0
you tried using either <BR> or just return carrages?
__________________
------------------------------------------------------------

Please login or register to view this content. Registration is FREE
- Black Prism professional web design services
------------------------------------------------------------
Wenslock is offline
Reply With Quote
View Public Profile
 
Old 03-08-2004, 12:49 PM
rbmingie's Avatar
Novice Talker

Posts: 5
Trades: 0
Yes, I tried that but it didn't work. Besides, the average person who fills out the application wouldn't think of using <br> and <p>, even if the knew html code.

Thanks anyway.
rbmingie is offline
Reply With Quote
View Public Profile Visit rbmingie's homepage!
 
Old 03-08-2004, 01:03 PM
techwench's Avatar
Code Monkey

Posts: 1,449
Name: Danalyn
Location: Dallas, TX
Trades: 0
What scripting language are you using to handle your form processing? What does your form script look like?

If you're using PHP, you can use: nl2br()
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
techwench is offline
Reply With Quote
View Public Profile
 
Old 03-08-2004, 01:17 PM
rbmingie's Avatar
Novice Talker

Posts: 5
Trades: 0
I am using cgi for the form. Do you think I should go in and alter the script in some way?

Thanks.
rbmingie is offline
Reply With Quote
View Public Profile Visit rbmingie's homepage!
 
Old 03-08-2004, 02:04 PM
techwench's Avatar
Code Monkey

Posts: 1,449
Name: Danalyn
Location: Dallas, TX
Trades: 0
You could try something like:
Code:
($text = $input{'text'}) =~ s/\n/\n<BR>/g;
If it's Perl.
The input value to the text name is copied to a $text array.

($text = $input{'text'})

All end of lines \n characters are substituted (s/.../ command) by \n<BR>.

s/\n/\n<BR>/g

The s/old_sting/new_string/ command is commonly used in Perl. The g at the end of the command indicates a global substitution (all instances get replaced) rather than the (default) first found.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
techwench is offline
Reply With Quote
View Public Profile
 
Old 03-10-2004, 11:30 AM
j_shanelec's Avatar
Novice Talker

Posts: 11
Location: Neverland
Trades: 0
i am not to famialr with JavaScript, but if they have a string replace function, you could do this. Have it find "\n", and replace it with "<br>", and u can call it from your form submit button like, onClick="ReplaceFunc(mytextarea);" or something like that. you would have to go see how to do it in javascript.
j_shanelec is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Paragraph and line breaks in textareas
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19824 seconds with 12 queries