Here is a custom tag I made (sharing is good). I know there is prob
others out there but this one is quite simple.
This tag can be used in any form submittal, where the use of profanity
is not desired(especially message boards).Place the tag in the your
processing page before doing your insert of form variables.
The use of the tag is quite simple, see below
<CF_BAD_WORD
FORMFIELDS="field1,field2,field3" /Comma delimeted list of form
field names
BADWORDS="badword1,badword2,badword3"> /Comma delimeted list of bad
words
Here is the code, save it under any name you like.
<!---
* Title: bad_word.cfm
* Author: Douglas Brown
* Date: 12/14/2001
* Usage: This tag can be used in any form submittal, where the use of
profanity is not desired
Place the tag in the your processing page before doing your insert of
form variables.
* Parameters: The use of the tag is quite simple, see below
<CF_BAD_WORD
FORMFIELDS="field1,field2,field3" /Comma Delimeted list of form
field names
BADWORDS="badword1,badword2,badword3"> /Comma Delimeted list of bad
words
//--->
<!---Declare our variables and set their values to the attributes
specified in the tag.//--->
<CFSET badwords = #attributes.badwords#>
<!---Replace the "," delimeted list of bad words with a "|" delimeted
list//--->
<CFSET badwords = #ReReplaceNoCase(badwords, "," , "|" , "ALL")#>
<CFSET formfields = #attributes.formfields#>
<CFOUTPUT>
<!---Loop through formfields element and set the value accordingly//--->
<CFLOOP index="i" LIST="#formfields#">
<CFSET #FORM_ELEMENT# = "FORM." & #i#>
<CFSET formfields = #evaluate(FORM_ELEMENT)#>
<!---If our formfields value is "" set it's value to NULL//--->
<CFIF formfields IS "">
<CFSET "CALLER.#i#" = "NULL">
<CFELSE>
<CFSET "CALLER.#i#" =
REREplaceNoCase("#evaluate(FORM_ELEMENT)#", "#badwords#", "*Dirty
Word*" , "ALL")>
</CFIF>
</CFLOOP>
</CFOUTPUT>
Doug
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists