For Programmers: Free Programming Magazines  


Home > Archive > ASP > September 2004 > Inserts HTML line breaks before all newlines in a string









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Inserts HTML line breaks before all newlines in a string
Chris Mach

2004-09-30, 3:55 pm

Hey,

If i'am writing a post in a "textarea" and i use the ENTER (newline) on my keyboard it comes as a line break <br> in my post on the forum.

PHP uses "nl2br", but what is the ASP solution for this?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.771 / Virus Database: 518 - Release Date: 28-Sep-2004
Jeff Cochran

2004-09-30, 3:55 pm

On Thu, 30 Sep 2004 08:02:11 -0400, "Chris Mach" <cjmach@gto.net>
wrote:

>If i'am writing a post in a "textarea" and i use the ENTER (newline) on my keyboard it comes as a line break <br> in my post on the forum.
>
>PHP uses "nl2br", but what is the ASP solution for this?


Depends on wht you actually want, but this may be what the equivalent
to PHP would be:

strPost = Replace(FormInput,VbCrLf,"<br>")

FormInput is what comes from the text area, strPost is the post with
HTML breaks.

Personally, I store the text verbatim in the database and replace on
retrieving it, but it could work either way.

Jeff
Chris Mach

2004-09-30, 3:55 pm


> Personally, I store the text verbatim in the database and replace on
> retrieving it, but it could work either way.


Yes, that is what I want to do, how is that done?

please? :D


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.771 / Virus Database: 518 - Release Date: 28-Sep-2004


Jeff Cochran

2004-09-30, 8:55 pm

On Thu, 30 Sep 2004 08:46:00 -0400, "Chris Mach" <cjmach@gto.net>
wrote:

>
>
>Yes, that is what I want to do, how is that done?


Are you asking how to save a text input field to a database field,
retrieve the data from the database, format it for display or all of
the above?

Might look at:

http://www.1asphost.com/asp_db.asp

It's not perfect, but will get you started.

Jeff
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com