HighDots Forums  

Add word check to text area?

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Add word check to text area? in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pupkin
 
Posts: n/a

Default Add word check to text area? - 11-08-2007 , 02:27 PM






Hi,

I have a form with a text area, and I'd like to add a function that
alerts the user when they type in a word that's on a list of forbidden
terms. We don't want to prevent them from submitting, but merely to
alert them of the potential infringement.

Is there a client-side way to do this? I don't know what to Google to
find the correct resource.

I also have a spell check on this field, but am not crazy about the
current script, so if there's a textarea spellchecker that will also
support flagging restricted words, that would be ideal.

Thanks.

Reply With Quote
  #2  
Old   
tfeserver
 
Posts: n/a

Default Re: Add word check to text area? - 11-10-2007 , 03:59 AM






Pupkin wrote:
Quote:
Hi,

I have a form with a text area, and I'd like to add a function that
alerts the user when they type in a word that's on a list of forbidden
terms. We don't want to prevent them from submitting, but merely to
alert them of the potential infringement.

Is there a client-side way to do this? I don't know what to Google to
find the correct resource.

I also have a spell check on this field, but am not crazy about the
current script, so if there's a textarea spellchecker that will also
support flagging restricted words, that would be ideal.

Thanks.
Hi,

You have 2 ways to do it: client side and server side:

the client side:
Generate the javascript using php or another with the badwords in an
array. like:
<script type="text/javascript">
var badwords=new Array(<?php echo join(", ",$badwords); ?>);
/* Script continues here */
</script>

the server side:
check the keyup signal and check if "space" or "dot" is entered.
Then check the word using ajax call.

Tell me what side do you want to do it, and i'll could help you.

--
tfe
http://tfeserver.homelinux.com



Reply With Quote
  #3  
Old   
Charles A. Landemaine
 
Posts: n/a

Default Re: Add word check to text area? - 11-24-2007 , 01:58 PM



On Sat, 10 Nov 2007 10:59:09 +0100, tfeserver wrote:
Quote:
check the keyup signal and check if "space" or "dot" is entered. Then
check the word using ajax call.
I think if he stores the array of bad words in JS, he can check on the
fly even faster without using Ajax, just checking with his client-side
list of bad words


--
Charles A. Landemaine
http://landemaine.blogspot.com


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.