codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Javascript Swear Word Filter

Article by: Premshree Pillai (8/16/2002)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Sponsored by: Neil Matthews Hypnotherapy, Wilmslow
Summary: This JavaScript is a "Word Filter". It is a type of form validator. When the user submits some text, the validator will check the text for words that has to be filtered.
Viewed: 18856 times Rating (27 votes): 
 4.8 out of 5
 Rate this Article  Read Comments  Post Comments

Javascript Swear Word Filter



This JavaScript is a "Word Filter". It is a type of form validator. When the user submits some text, the validator will check the text for words that has to be filtered.

The words that have to be filtered must be added to the array swear_words_arr. When the user types the text and hits the submit button, if the text contains any word that is present in the array swear_words_arr, the form will not be submitted.

The script can be used for validation of swear words etc.

Place the following code in the head tag of your page.

Select All Code


Now here's the form:

Select All Code







CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on 'Javascript Swear Word Filter'
Posted by :  Archive Import (Greg) at 12:21 on Wednesday, October 23, 2002
Cool!

This could come in handy in a corporate environment.
Thanks.
Posted by :  Archive Import (Rick) at 14:36 on Friday, October 25, 2002
I've been able to sucessfully install the code so that the warning message appears when I type in an illegal word.

However, the form still gets submitted after I click OK. I'm using a program called formmail.php on my site. Am I missing something?
Posted by :  Archive Import (Drew Bowman) at 23:14 on Thursday, December 19, 2002
Rick I too am using a similar file for formed email. Make sure to change all of the "form1" commands in your document to what your formmail.php file demands or if possible just change the formmail.php commands.
Posted by :  Archive Import (David Eckert) at 12:29 on Wednesday, March 05, 2003
Does not work for uppercase words
Posted by :  Archive Import (Jimmy) at 15:18 on Wednesday, August 27, 2003
This is off the subject at hand, but I have no idea if my comments weren't posted for this article because there's an editorial process or if they just went to bit-heaven. I found myself redirect to the main index. If this is moderated and that's the reason for the delay, it should be noted as such after submission.
Posted by :  cherni99 at 06:28 on Tuesday, June 27, 2006
with regard to this [b]Does not work for uppercase words[/b] - convert the entire string to LowerCase then check!!


To post comments you need to become a member. If you are already a member, please log in .

 











Recent Forum Threads
• Re: Insert Contents of .txt file into a .html page
• Re: Perl regular expression problem.
• Re: Problems in login using WWW::Mechanize
• searching for gd::graph guide
• Re: ARRAY OF HASHMAPS
• Adv. Regexp or Otherwise
• Adv. Regexp or Otherwise
• I need help pleasee! My project is about using I/o Stream
• Help Running VB script in Windows 2003


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008