CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.

YesSoftware Forums -> CodeCharge -> General/Other

 New line or break line on TextArea Fields

Print topic Send  topic

Author Message

Posts: 181
Posted: 12/14/2005, 12:25 PM

In the before update and before insert event (for the textarea), place the following code.

Dim sResult
sResult = RecordName.TextAreaFieldName.Value

sResult = Replace(sResult, vbCRLF, "<br>")

Testing For Chr(13) only looks for the Carriage Return... not the line feed as well. So you need to perform the replace on the combination of the two - or vbCRLF.

Chr(13) + Chr(10) Carriage return–linefeed combination

View profile  Send private message

Posts: 181
Posted: 12/14/2005, 12:26 PM

Sorry, didn't notice page two - and then saw it had already been answered.

My apologies.
View profile  Send private message
Posted: 01/26/2006, 2:51 AM

Quote test:
<font size=72>test</font>
Posted: 02/11/2006, 5:24 AM

this works totally fine for me :

// break line
$text = eregi_replace("\n","<br>",$text);
Posted: 02/22/2006, 2:41 PM

The problem is, you cannot insert the line breaks in VBScript, I know because I have been messing with the problem for awhile and gave up on it after awhile after trying everything. I was told to come back and fix the problem and finally I was able to, but not through vbscript, through javascript. You need to create a javascript function to insert the line break, and then run that function from the vbscript. So in javascript lets say you have a textarea box named TextareaText. You could then run the following javascript to grab the current value of the textarea and append the line break to the end:

document.all('TextareaText').value = document.all('TextareaText').value + '\n';

If you want to run this from vbscript put it in a function and just call the function name from within vbscript to execute a line break, for instance if the javascript function is named TextareaLineBreak and you wanted to insert a line break after the current text in the textarea box, then insert new text you could simply put the following in your vbscript:

document.body.all("TextareaText").value = TextareaLineBreak() + 'this text will appear on a new line'

I just tested this and it works fine
Posted: 02/22/2006, 9:08 PM

Quote Solster:
It works when you replace with "\n" in double quotes, and doesn't work in single quotes. Donno why.

<textarea name="Address" rows="5" cols="35"><?php echo str_replace('<br>', "\n", $myrow["Address"]); ?></textarea>

Amazingly, the double quotes was the trick in PHP. Thanks.

Posted: 04/08/2006, 10:55 PM

Hey guys,
Thank u very much for this group discussion,
I got my solution...:-)
Posted: 05/29/2006, 12:36 PM

In php (and other I suppose) the single quote mark ( 'text' ) prints out the exact text inside the quote. so if you want to replace <br> with a line break you should NOT do something like this:

$whatever = str_replace('<br>', '\n', $text)

cuz if will infact be puting \\n into the text ( \\ beeing the special char to print \ and then adding the n)

This however would work and put a line break for each <br>:

$whatever = str_replace("<br>", "\n", $text)

And thx everybody.. this discussion really helped me :)
Posted: 05/31/2006, 6:29 PM

in php you can do this:

echo str_replace("<br />", chr(13), "blah <br /> blah");


Posted: 06/15/2006, 7:07 PM

Programming text into the Textarea I was having the same problems with \n returning just n, \n\n returning nn, and <br> displaying as <br>.

After trying the double slashes it worked. ie \\n

Posted: 06/16/2006, 3:24 AM

i had the same problem, but now it's solved...
"\n" makes a new line in textarea...

First Prev Page 2 of 2 

Add new topic Subscribe to topic   

These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit

Web Database

Join thousands of Web developers who build Web applications with minimal coding.

Home   |    Search   |    Members   |    Register   |    Login

Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by  and YesSoftware, Inc.