|
|
Javascript Swear Word Filter
|
| Article by: | Premshree Pillai (8/16/2002) |
|
| 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: 60217 times |
Rating (28 votes): |
|
4.8 out of 5 |
|
|
|
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.
Now here's the form:
|
|
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 (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 .
| |