Email Validation not working eventhough javascript is enabled and jquery validation working in some cases -


i have issue puzzling me. have created web page on click of button opens bootstrap modal window contains form , form used jquery validation. strange part getting invalid email submissions like:

  1. hgchjf kdf surb. j;e563@gamil .com
  2. 991199
  3. hcvjh cds zm mnbv42768
  4. ali@hzhsbvxbs
  5. ئؤؤللاااتتتن 7حع9ه7908غ7898خح8ح9هع9

assuming javascript not enabled, 1 cannot see form submission out of question.

the jquery validation working correctly , have tested several different scenarios. validation script follows

<script type="text/javascript">     $(document).ready(function(){                 $("#contact-us-form").validate({                       rules:{                         emailaddress:{                         minlength: 5,                         maxlength: 255,                         required: true,                         validemail: true                         }                       },             ignore: '',              highlight: function(element) {                     $(element).addclass('error_new');                       //highlight label                 var textelement = "#"+($(element).attr("name"))+"_text";                 $(textelement).addclass('error_text');                  //highlight border                 if($(element).siblings().length > 0){                     var nextelement = $(element).siblings();                     $(nextelement).css("border-color","#f00");                   }              },             unhighlight: function(element) {                 $(element).removeclass('error_new');                                                  var textelement = "#"+($(element).attr("name"))+"_text";                 $(textelement).removeclass('error_text');                  if($(element).siblings().length > 0){                                        var nextelement = $(element).siblings();                     $(nextelement).css("border-color","#ccc");                   }                             },             errorplacement: function(error, element) {               if($(element).attr("name") == "emailaddress"){                 error.appendto( element.parent("div") );               }             },             messages: {               emailaddress: {                 required: "please enter valid email adress",                 email: "please enter valid email adress"               }            }                       });        jquery.validator.addmethod("validemail", function(value, element)  {    if(value == '')      return true; var temp1; temp1 = true; var ind = value.indexof('@'); var str2=value.substr(ind+1); var str3=str2.substr(0,str2.indexof('.')); if(str3.lastindexof('-')==(str3.length-1)||(str3.indexof('-')!=str3.lastindexof('-')))     return false; var str1=value.substr(0,ind); if((str1.lastindexof('_')==(str1.length-1))||(str1.lastindexof('.')==(str1.length-1))||(str1.lastindexof('-')==(str1.length-1)))     return false; str = /(^[a-za-z0-9]+[\._-]{0,1})+([a-za-z0-9]+[_]{0,1})*@([a-za-z0-9]+[-]{0,1})+(\.[a-za-z0-9]+)*(\.[a-za-z]{2,3})$/; temp1 = str.test(value); return temp1; }, "please enter valid email.");     }); </script> 

i not understand why getting invalid email submissions. ideas on issue lot helpful.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -