1jQuery(function($){ 2 $(function() { 3 function submissionDate() { 4 var myDate = new Date(); 5 var options = { 6 year: "2-digit", month: "2-digit", 7 day: "2-digit", hour: "2-digit", minute: "2-digit" 8 }; 9 var dateString = myDate.toLocaleTimeString("en-us", options).replace(/,/g, ''); 10 return dateString; 11 } 12 13 14 function commentHasLink(comment) { 15 if (comment !== undefined && comment !== "" && (comment.toLowerCase().indexOf("http")>-1 || comment.toLowerCase().indexOf("ftp")>-1)) { 16 return true; 17 } else { 18 return false; 19 } 20 } 21 22 $.validator.addMethod( 23 "validatornolinks", function(value,element){ 24 if(commentHasLink(value)){ 25 return false; 26 } else { 27 return true; 28 } 29 },"Please exclude links from your submission.") 30 31 $.validator.addMethod( 32 "musthaveproperty", function(value,element){ 33 if(value){ 34 return true; 35 } else { 36 return false; 37 } 38 },"Please choose at least one property.") 39 40 $.validator.addMethod( 41 "validemail", function(value,element){ 42 if(value && value.indexOf("@")!=-1 && value.indexOf(".")!=-1){ 43 return true; 44 } else { 45 return false; 46 } 47 },"Please enter a valid e-mail address.") 48 49 $.validator.addMethod( 50 "reallyrequired", function(value,element){ 51 if(value && value.trim().length>0){ 52 return true; 53 } else { 54 return false; 55 } 56 },"This field is required.") 57 58 59 $.validator.addMethod( 60 "validphonenumber", function(value,element){ 61 if (value && (value.trim().length > 0) && (value.trim().length < 10)) { 62 return false; 63 } else { 64 var digits = value.replace(/\D/g,''); 65 if ( (!(digits)) || (digits && (digits.length < 10)) ) { 66 return false; 67 } else { 68 if( (digits.length==10 && digits[0]!='1' && digits[0]!='0') || (digits.length==11 && digits[0]=='1') || (digits.length==14 && digits.substring(0,4)=='0111') || (digits.length==12 && digits.substring(0,2)=='52') || (digits.length==15 && digits.substring(0,5)=='01152')) { 69 return true; 70 } 71 else { 72 return false; 73 } 74 } 75 } 76 },"Please enter a valid phone number.") 77 78 79 80 $('form.contact-form').each(function(){ 81 var $form = $(this); 82 //var $propertiesList = $form.find('[name="ShoppingCenters"]'); 83 84 $form.validate({ 85 ignore: ".ignore", 86 rules: { 87 FirstName: { 88 required: true, 89 reallyrequired: true, 90 validatornolinks:true 91 }, 92 LastName: { 93 required: true, 94 reallyrequired: true, 95 validatornolinks:true 96 }, 97 WorkPhone: { 98 reallyrequired: true, 99 validatornolinks:true, 100 validphonenumber: true 101 102 }, 103 RequestorEmailAddress: { 104 required: true, 105 reallyrequired: true, 106 minlength: 5, 107 validemail: true, 108 validatornolinks:true 109 }, 110 QuestionsComments: { 111 required: true, 112 reallyrequired: true, 113 validatornolinks:true 114 }, 115 ShoppingCenters: { 116 musthaveproperty: true 117 } 118 }, 119 submitHandler: function (form) {
120 $('[name="SubmissionDate"]').val(submissionDate()); //adds the date to the hidden field 121 form.submit(); 122 } 123 }); 124 125 }); // end each 126 }); 127});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.