function MM_validateForm() { var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; j=0; // /^([-a-zA-Z0-9._]+@[-a-zA-Z0-9.]+(\.[-a-zA-Z0-9]+)+)$/; var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; var regBlank = /[^\s]/; var regAlphaNum = /^([a-zA-Z0-9_]+)$/; var regDate = /^([0-9_]+-[0-9][0-9]+-[0-9][0-9]+)$/; //alert (MM_validateForm.arguments[1].name); //alert("sss--->"+document.forms[""+args[0]].elements[""+args[0]].value); for (i=1; i<(args.length-2); i+=3) { mesg=args[i+1]; test=args[i+2]; val=document.forms[""+args[0]].elements[""+args[i]]; if (val) { nm=mesg; val = val.value; //if ((val=val.value)!="") if(regBlank.test(val)) { if(test.indexOf('isEqual')!=-1) { result = trim(val); if(result.length==0){ errors += '- '+nm+' is required.\n'; }else{ equal_obj_val = test.substring(8,test.indexOf(":")); mesg_string =test.substring((test.indexOf(":")+1)); if(val != document.forms[""+args[0]].elements[""+equal_obj_val].value) { errors+='- '+nm+' must be same to '+mesg_string+'.\n'; } } } else if(test.indexOf('isAlphaNum')!=-1) { result = trim(val); if(result.length==0){ errors += '- '+nm+' is required.\n'; }else{ if(!regAlphaNum.test(val)) { errors+='- '+nm+': Only Alpha Numeric and "_" Chars Allowed.\n'; } } } else if (test.indexOf('isDate')!=-1) { p=val.indexOf('-'); if (p != 4 ) { errors+='- '+nm+' must contain Valid Date YYYY-MM-DD.\n'; } else if(!regDate.test(val)) { errors+='- '+nm+' must contain Valid Date YYYY-MM-DD.\n'; } } else if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); s=val.indexOf('.'); if (p<1 || p==(val.length-1)) { errors+='- '+nm+' must contain an e-mail Address.\n'; } //else if(s