Folks: ... one general question wrapped in several related issues: hope u can help!
(hope also 500 points if sufficient for this plethora of pain)
I'm TRYING to create a cfm page that takes the following input:
- a text input field for an article 'title' (i.e. the description of the article)
- a text input field for an article's 'text' (i.e. the body of the article)
I DON'T want ANY HTML CODE <b></b> stuff etc in the TITLE ...
BUT I DO want to allow HTML CODE in the BODY of the article.
PLUS ... I DO WANT to be able to OUTPUT the BODY of the article, showing the neat HTML.
-- does the above make sense? --
- my problem:
: I found the terrific SafeText() tag/'function' .. and I think I installed it correct ... SO THAT I can STRIP ANY html code from the text_title input form field. BECAUSE I get errors when I try to insert such variable with HTML code (and it doesn't make sense to have it in the title field anyway).
problem is: I obviously don't know how to use SafeText() because my .cfm that INSERTS the form.input_title variable is saying 'SAFETEXT is undefined'.
I used it as such:
<cfquery name="PostArticle" datasource="fred">
insert into article_table (article_title, article_text)
values ('#SafeText(form.input_article_text, 1)#', '#SafeText(form.input_article_text)#', )
(where the ',1' strips ALL html out, ELSE defauts to JUST stripping out naughty HTML code leave all good html code intact (which I want for the body text).
WHAT am I doing WRONG!? I placed the SafeText.cfm into my 'c_tags' subfolder with other cf tags / functions etc.
My related issue:
SO I've successfully managed (besides the SafeText problem) to INSERT an article containing lots of text with the odd <b> </b> etc .. into my table record.
WHEN I try to OUTPUT as a sexy formatted looking HTML-based article ... I get a lousy WRAPPED text field:
i.e. .. my database holds
<b>This is an example</b>
Written by Richard Buchanan, the Opinion Exchange
blah blah blah blah.
BUT when I output ... I get this:
<b>This is an example</b>Written by Richard Buchanan, the Opinion Exchange blah blah blah blah.
Which is AWFUL!
Any ideas? I feel pretty comfortable that my database table record is holding the article correctly with line breaks, html codes etc. It's just not outputting correctly.
Thanks much! Sorry for the multitudes of agony.
the Opinion Exchange