function convertToUpper(src) { //alert("Hi from convertToUpper"); src.value = src.value.toUpperCase(); } function isEmpty(s) { //alert("Hi from isEmpty"); if((s == null) || (s.length <= 0)) return true; return false; } function checkNumberCharEnter(obj,event) { //alert("Hi from checkNumberCharEnter"); if(obj.value != '') { if(!checkNumberChar(event)){ alert('Please enter Alpha only'); obj.value=''; obj.focus(); return false; } return true; } } // Below Function will check for any special charaters in a string // and will remove them if found any. // Author : Ravi Bhuva (329926) function checkSpecialCharacters(element) { var str = element.value.toString(); //alert('str ::> '+str); var specialChars = "!@#$^&*()+=-[]\\\';,./{}|\":<>?`~%"; var validFlag = true; var invalidCnt = 0; if(str != null && str.toString() != '') { for(i=0; i '+str.charAt(i)); if(specialChars.indexOf(str.charAt(i)) != -1) { //alert('in if :::> '+specialChars.indexOf(str.charAt(i))); //str = str.replaceAll(str.charAt(i), ""); str = str.replace(new RegExp(str.charAt(i), 'g'),""); //alert('result str :::> '+str); validFlag = false; invalidCnt++; } } element.value = str; //alert('element value ::> '+str); if(invalidCnt == 1) { alert(_cmnMsgSFChkSpclChar); } else if(invalidCnt > 1) { alert(_cmnMsgSFRmvSpclChar); } } return validFlag; } // Below Function restrict entry of all characters except the ones // specified in exceptThese argument (regular expression). // Author : Ravi Bhuva (329926) function restrictChar(exceptThese) { //alert('restrictChar'); //exceptThese = "-_,/'().0-9a-zA-Z \r"; //get the keycode when the user pressed any key in application var exp = String.fromCharCode(window.event.keyCode); //Below line will have the special characters that is not allowed you can add //if you want more for some characters you need to add escape sequence var r = new RegExp("["+ exceptThese +"]", "g"); if (exp.match(r) == null) { window.event.keyCode = 0; return false; } return true; } //New function added for Cross browser issues in Mozilla Firefox and Chrome //Below Function restrict entry of all characters except the ones //specified in exceptThese argument (regular expression). //requires event object to be passed in function parameter list function restrictChar(exceptThese,event) { //alert('restrictChar'); //exceptThese = "-_,/'().0-9a-zA-Z \r"; //get the keycode when the user pressed any key in application var keycode; keycode=event.keyCode? event.keyCode : event.charCode; if( keycode == 8 ) { return true; } var exp = String.fromCharCode(keycode); //Below line will have the special characters that is not allowed you can add //if you want more for some characters you need to add escape sequence var r = new RegExp("["+ exceptThese +"]", "g"); if (exp.match(r) == null) { //window.event.keyCode = 0; return false; } return true; } //Below Function restrict entry of all characters except the ones //specified in exceptThese argument (regular expression) on copy/paste action. //Author : Tarak Amin (670751) function restrictCharOnBlur(exceptThese, elementRef, alertMsg) { //below lines commented as event object has not been passed to obtain keycode for Mozilla Firefox. /*var evtobj; if(window.event){ evtobj = window.event.keyCode;//for ie } else{ evtobj = e.which; } if( evtobj == 8 ) { return true; }*/ var exp; //Below line will have the special characters that is not allowed you can add //if you want more for some characters you need to add escape sequence var r = new RegExp("["+ exceptThese +"]", "g"); exp = elementRef.value; for (var i=0; i