Print Page | Close Window

Formatting a editbox input to html

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3263
Printed Date: 30 March 2026 at 12:10am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Formatting a editbox input to html
Posted By: stDeaReG
Subject: Formatting a editbox input to html
Date Posted: 04 June 2003 at 7:47am

I'm completely stuck on this. I'm trying to build a forum and I use a editbox for users to enter their messages in. Now when I post this to my access database it gets inserted correctly with the lines seperate. However when I load the post on my asp page it is one long line without using the formatting.

Now I guess somehow I have to insert a html tag like <br> in the database, but I can't seem to figure out how to make the code replace all "enters" with <br> in the database.

Help me! , TIA.




Replies:
Posted By: Scotty32
Date Posted: 04 June 2003 at 7:53am

use the

 replace(string, vbcrlf,"<br>")

you might also want to stop people using HTML and use Formatting like this forum uses (look at the Forum Codes for examples)

just change the above to...

 replace(string, "[i]", "<i>")

so when ever sum one types "[i]" it will make there text Italic

*edit*

sorry forgot to say...

the code above would be used like this

<%
        dim sting
string = request.form("TextArea") 'this is your Form Field

string = replace(string, vbcrlf, "<br>")

......rest of your code for adding to the database here....

%>



Posted By: stDeaReG
Date Posted: 04 June 2003 at 10:13am
Thanks bunches, works like a charm


Posted By: MorningZ
Date Posted: 04 June 2003 at 10:35am
as said above.. beware allowing people to enter straight up HTML....  they can put some nasty javascript in there or even as something stupid as just </table> which will totally screw up your layout

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: ljamal
Date Posted: 04 June 2003 at 9:03pm
If you are not going to allow HTML then I would just create a function to remove all HTML.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: stDeaReG
Date Posted: 05 June 2003 at 5:23am

actually I'm making it so i don't allow certain things, for instance javascript, tables, body, etc.

I do want people to allow the use of font and stuff on there so.
Also just added 64 smileys. hehehe




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net