1//<script type="text/javascript"> 2 3function isEmpty(elem, helperMsg){ 4 if(elem.value.length == 0){ 5 alert(helperMsg); 6 //elem.style.background = 'Yellow'; 7 elem.className = 'alert'; 8 elem.focus(); // set the focus to this input 9 return false; 10 }else{ 11 //elem.style.background = 'White'; 12 elem.className = 'norm'; 13 return true; 14 } 15} 16 17function isZero(elem, helperMsg){ 18 var elemValue = parseInt(elem.value); 19 if(elemValue == 0){ 20 alert(helperMsg); 21 //elem.style.background = 'Yellow'; 22 elem.className = 'alert'; 23 elem.focus(); // set the focus to this input 24 return false; 25 }else{ 26 //elem.style.background = 'White'; 27 elem.className = 'norm'; 28 return true; 29 } 30} 31 32function isNumeric(elem, helperMsg){ 33 var numericExpression = /^[0-9]+$/; 34 if(elem.value.match(numericExpression)){ 35 //elem.style.background = 'White'; 36 elem.className = 'norm'; 37 return true; 38 }else{ 39 alert(helperMsg); 40 elem.focus(); 41 //elem.style.background = 'Yellow'; 42 elem.className = 'alert'; 43 return false; 44 } 45} 46 47function isAlphabet(elem, helperMsg){ 48 var alphaExp = /^[a-zA-Z]+$/; 49 if(elem.value.match(alphaExp)){ 50 //elem.style.background = 'White'; 51 elem.className = 'norm'; 52 return true; 53 }else{ 54 alert(helperMsg); 55 //elem.style.background = 'Yellow'; 56 elem.className = 'alert'; 57 elem.focus(); 58 return false; 59 } 60} 61 62function isAlphanumeric(elem, helperMsg){ 63 var alphaExp = /^[0-9a-zA-Z]+$/; 64 if(elem.value.match(alphaExp)){ 65 //elem.style.background = 'White'; 66 elem.className = 'norm'; 67 return true; 68 }else{ 69 alert(helperMsg); 70 //elem.style.background = 'Yellow'; 71 elem.className = 'alert'; 72 elem.focus(); 73 return false; 74 } 75} 76 77function stringPosRestriction(elem, first_index,last_index, check_string, helperMsg){ 78 var uInput = elem.value; 79 if(uInput.substring(first_index,last_index) == check_string){ 80 //elem.style.background = 'White'; 81 elem.className = 'norm'; 82 return true; 83 }else{ 84 alert(helperMsg); 85 //elem.style.background = 'Yellow'; 86 elem.className = 'alert'; 87 elem.focus(); 88 return false; 89 } 90} 91 92function stringPosAllowed(elem, first_index,last_index, check_string, helperMsg){ 93 var uInput = elem.value; 94 if(uInput.substring(first_index,last_index) == check_string){ 95 alert(check_string + " is not allowed at the given position in " + helperMsg); 96 //elem.style.background = 'Yellow'; 97 elem.className = 'alert'; 98 elem.focus(); 99 return false; 100 }else{ 101 //elem.style.background = 'White'; 102 elem.className = 'norm'; 103 return true; 104 } 105} 106 107function lengthRestriction(elem, min, max, helperMsg){ 108 var uInput = elem.value; 109 if(uInput.length >= min && uInput.length <= max){ 110 //elem.style.background = 'White'; 111 elem.className = 'norm'; 112 return true; 113 }else{ 114 if (min == max) { 115 alert("Please enter valid " + max + " digit " + helperMsg); 116 }else{ 117 alert("Please enter valid " + helperMsg + " between " + min + " and " +max+ " characters"); 118 } 119 //elem.style.background = 'Yellow'; 120 elem.className = 'alert'; 121 elem.focus(); 122 return false; 123 } 124} 125 126function madeSelection(elem, helperMsg){ 127 var uInput = elem.options[elem.selectedIndex].value 128 if(uInput == ""){ 129 alert("Please Choose " + helperMsg); 130 elem.focus(); 131 //elem.style.background = 'Yellow'; 132 elem.className = 'alert'; 133 return false; 134 }else{ 135 //elem.style.background = 'White'; 136 elem.className = 'norm'; 137 return true; 138 } 139} 140 141function emailValidator(elem, helperMsg){ 142// return true; // for localhost testing 143 var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/; 144 if(elem.value.match(emailExp)){ 145 //elem.style.background = 'White'; 146 elem.className = 'norm'; 147 return true; 148 }else{ 149 alert(helperMsg); 150 //elem.style.background = 'Yellow'; 151 elem.className = 'alert'; 152 elem.focus(); 153 return false; 154 } 155} 156 157function stringCompare(elem, elemv, helperMsg) { 158 var uInput = elem.value; 159 var uInputv = elemv.value; 160 if(elem.value.length == 0 || (uInput.length == uInputv.length && uInput == uInputv)){ 161 //elem.style.background = 'White'; 162 elem.className = 'norm'; 163 return true; 164 }else{ 165 alert(helperMsg); 166 //elem.style.background = 'Yellow'; 167 elem.className = 'alert'; 168 elem.focus(); 169 return false;
170 } 171} 172 173function checkCheckBox(elem, helperMsg){ 174//if (formname.formelement.checked == false ) 175 if (elem.checked == true) { 176 //elem.style.background = 'White'; 177 elem.className = 'norm'; 178 return true; 179 }else{ 180 alert(helperMsg); 181 //elem.style.background = 'Yellow'; 182 elem.className = 'alert'; 183 elem.focus(); 184 return false; 185 } 186} 187//</script>
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.