Skip to main content
Participant
March 19, 2007
Question

User Content Formatting?

  • March 19, 2007
  • 5 replies
  • 363 views
I'm playing around with a simple system, learning as I go, and I want to implement a comments system - but I don't want users to have to put in HTML or anything. Obviously if the user enters straight text any paragraphs are ignored when the text is re-displayed....

....how do I apply some formatting to text, remembering the paragraphs at least, without having the users put codes in?

I won't be surprised if the answer is surprisingly simple :)
This topic has been closed for replies.

5 replies

March 27, 2007
You can use WRAP="soft" or WRAP="hard" in your TEXTAREA tag. Hard sends the carriage return to the server; soft does not.
Inspiring
March 27, 2007
just one things: a nice little free udf from cflib.org which will
a) strip any html tags from user's input
and
b) replace #chr(10)# & #chr(13)# in the input with <br>
--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Participant
March 27, 2007
I've tried HTMLCode and HTMLEdit functions so far (I realise that's not their official names but you'll no what I mean). Neither was perfect, HTMLCode kept the paragraphs but gave it a mono-font. HTMLCode didn't keep the paragraphs.

I'll try paragraphformat this evening.

Basically, I want people to be able to:
(a) type in the comments textarea field and have their paragraphs and spacing maintained.
(b) render all HTML they might put in harmless - I'll warn them this is going to happen.

That's it, loads of sites do it, I'm guessing it's not *that* complex and I'm just missing something.

Thanks.
Inspiring
March 20, 2007

did you try paragraphformat() function?

--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com
Inspiring
March 19, 2007
Well, it can be as simple or as complicated as you desire.

One of the simplest is the HTML <pre></pre> tag.

Text put into this tag will NOT ignore white space characters such as
cariage returns and line feed. That is it's purpose in life. The text
is also displayed in a mono-space font by default, but CSS can modify
this if desired.