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