Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Formatting a editbox input to html
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Formatting a editbox input to html

 Post Reply Post Reply
Author
stDeaReG View Drop Down
Newbie
Newbie


Joined: 04 June 2003
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote stDeaReG Quote  Post ReplyReply Direct Link To This Post Topic: Formatting a editbox input to html
    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.

Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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....

%>



Edited by Scotty_32
Back to Top
stDeaReG View Drop Down
Newbie
Newbie


Joined: 04 June 2003
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote stDeaReG Quote  Post ReplyReply Direct Link To This Post Posted: 04 June 2003 at 10:13am
Thanks bunches, works like a charm
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
stDeaReG View Drop Down
Newbie
Newbie


Joined: 04 June 2003
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote stDeaReG Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.