Cera

validateMessage

May 15th, 2012
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function validateMessage(){
  3.     var notAllowed = ['viagra','ciallis','penis'];
  4.    
  5.     for(var i = 0; i < notAllowed.length; i++){
  6.         if(document.contact_form.cf_message.value.indexOf(notAllowed[i]) != -1){
  7.             alert('The word "' + notAllowed[i] + '" is not allowed');
  8.             document.contact_form.cf_message.value = document.contact_form.cf_message.value.substr(0, document.contact_form.cf_message.value.indexOf(notAllowed[i]));
  9.             break;
  10.         }
  11.     }
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment