Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 7th, 2003, 06:17 AM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default Plain text to html in a form

Hi,

Is there a way that a user can type plain text into a form Multi Text Box and it gets converted to html code when submitted, I.e. it puts in the <br> tags ?

Thanks,
Ells.
__________________
Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
[email protected]
 
Old August 13th, 2003, 02:49 AM
Authorized User
 
Join Date: Jun 2003
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to planeswalk
Default

Hi,

You can try using regular expressions to replace the carriage-returns and newlines with <br> elements. There is a good tutorial on Regular Expressions on http://www.4guysfromrolla.com/webtech/120400-1.shtml. The "pattern" that you need to replace would be vbCrlF, which is the newline I am referring to.

Cheers!

Marlon Villarama
Support Team
Web Burner Hosting
[email protected]
www.webburner.com
877-535-2876
 
Old August 29th, 2003, 08:13 AM
Registered User
 
Join Date: Aug 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If the problem is just of having <br/> tags then, just do the following. Display the text which U have in a <p></> tag. This would print the text as the user formatted it.

Thanks and regards,

Raj Babar
 
Old September 1st, 2003, 10:10 AM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default

Quote:
quote:Originally posted by bsraj4u
 If the problem is just of having <br/> tags then, just do the following. Display the text which U have in a <p></> tag. This would print the text as the user formatted it.

Thanks and regards,

Raj Babar
Thanks Raj, unfortunately, even with the text within the <p></p> tages, the carriage returns do not show.
My code looks like this:
<p><% response.write rsuser("Content") %></p>

Thanks for your help,
Chris.

Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
[email protected]
 
Old September 1st, 2003, 10:11 AM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default

Quote:
quote:Originally posted by planeswalk
 Hi,

You can try using regular expressions to replace the carriage-returns and newlines with <br> elements. There is a good tutorial on Regular Expressions on http://www.4guysfromrolla.com/webtec....shtml. The "pattern" that you need to replace would be vbCrlF, which is the newline I am referring to.

Cheers!

Marlon Villarama
Support Team
Web Burner Hosting
[email protected]
www.webburner.com
877-535-2876

Hi Marlon,

I already have code that replaces the ' with `
Is there a way to replace two things on the same line, I.e. replace ' with ` and vbCrlF with <br> ?

My code is:
UpdateContent = Replace(Request.Form("GetContent"),"'","`")

Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
[email protected]
 
Old September 1st, 2003, 10:41 AM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default

I've managed to get the replace working, but it doesn't seem to recognise the vbCrlF as the carriage return entered in the form.

If I change the code to replace the word ENTER to <br> it works.

The code is:
UpdateContent = Replace(Request.Form("GetContent"),"'","`")
UpdateContent = Replace(UpdateContent,"vbCrlF", "<br>")

Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
[email protected]
 
Old September 1st, 2003, 11:26 AM
Authorized User
 
Join Date: Aug 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ells228
Default

I've sorted the problem out.

I used the following code in the display page:
<% = Replace(rsuser("Content"),VbCrLf, "<br>") %>

Thanks for all your help guys.

Cheers,
C.

Chris Ellis
Icon-Business Ltd
www.icon-business.net
[email protected]





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show plain format from html hdpark BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 14 November 26th, 2008 05:31 PM
getting plain text for .svc file bhavsac Windows Communication Foundation 8 November 9th, 2006 02:27 PM
Changing between bold and plain text in a text box funkybuddha Access 2 January 3rd, 2006 10:15 AM
plain vs HTML format juergreh Beginning PHP 2 April 19th, 2005 08:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.