Blame | Last modification | View Log | RSS feed
function trim (strVar) {if(strVar.length >0){while(strVar.charAt(0)==" ")strVar=strVar.substring(1,strVar.length);while(strVar.charAt(strVar.length-1)==" ")strVar=strVar.substring(0,strVar.length-1);}return strVar;}function isEmpty(elem){if(trim(elem.value).length == 0){//alert(error);elem.focus();return false;}else {return true;}}function emailValidator(elem){var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;if(!elem.value.match(emailExp)){//alert(error);elem.focus();return false;} else {return true;}}function validatePwd(pw1,pw2){var minLength = 4;if(pw1.value.length>0 || pw2.value.length>0){var helperMsg = "Password length should be mimimum 4 characters long !";if (pw1.value.length < minLength ){alert(helperMsg);pw1.focus();return false;}var helperMsg = "You did not enter the same new password twice !";if (pw1.value != pw2.value){alert(helperMsg);pw2.focus();return false;}return true;}else{return true;}}function isNumeric(elem){var numericExpression = /^[0-9]+$/;if(elem.value.match(numericExpression)){return true;}else{elem.focus();return false;}}function isNotSpecialChar(elem, helperMsg){var errormsg=document.getElementById('errormsg');//var alphaExp = /[_~`!@#\$%\^&\*\(\)\-_\+=\\/|,"'><\.:;\?]+/;if(elem.value.match(alphaExp)){alert("Your name cannot not contain special symbols");elem.focus();return false;}else{var numericExpression = /[0-9]+/;if(elem.value.match(numericExpression)){alert("Your name cannot not contain numbers");elem.focus();return false;}else{var numericExpression = /^\s+/;if(trim(elem.value)==''){alert(helperMsg);elem.focus();return false;}else{return true;}}}}/////////////////////////////////////////////////////////////////////////////////////////////////////////////function isAlphanumeric(elem, helperMsg){var errormsg=document.getElementById('errormsg');var alphaExp = /^[0-9a-zA-Z]+$/;if(elem.value.match(alphaExp)){return true;}else{errormsg.innerHTML = "<img src='"+imgpath+"/error.gif' > "+helperMsg;elem.focus();return false;}}function datevalidation(id1,id2,id3,helperMsg){var errormsg=document.getElementById('errormsg');if(id1.value=="Month" || id2.value=="Day" || id3.value=="Year"){errormsg.innerHTML="<img src='"+imgpath+"/error.gif' > "+helperMsg;return false;}return true;}function isSelected(ddl){var errormsg=document.getElementById('errormsg');if(ddl.selectedIndex<=0){errormsg.innerHTML = "<img src='"+imgpath+"/error.gif' > "+helperMsg;ddl.focus();return false;}else{return true;}}function imagevalidate(elem,divId){var errormsg=document.getElementById(divId);if(elem.value==""){errormsg.innerHTML="Please select the image !";//helperMsg="Please select the file !";elem.focus();return false;}else if(!/(\.jpg|\.jpeg|\.png|\.gif)$/i.test(elem.value)){errormsg.innerHTML="Please select .jpeg,.jpg,.gif,.png files only !";//helperMsg="Please select .jpeg,.jpg,.gif,.png files only !";elem.focus();return false;}return true;}