function getVars(){ this.fieldN = new Array(); // Field name this.fieldV = new Array(); // Field value this.fieldT = new Array(); // Field type (text, editor, checkbox, radio, select, mselect, date) this.fieldI = new Array(); // Field Id this.fieldC = new Array(); // Check for equal field this.fieldEQ = new Array(); // Check for equal supplied string match this.fieldNM = new Array(); // if 1 Check for field is Numeric this.fieldGT = new Array(); // Check for Greater than supplied string (works for field type text and date only) this.fieldLT = new Array(); // Check for Less than supplied string (works for field type text and date only) this.fieldGE = new Array(); // Check for Grter thn o equal to supplied str(works for field type text & date only) this.fieldLE = new Array(); // Check for Less than o equal to supplied string(works for field type text & date only) this.fieldBT = new Array(); // Check for between 2 values (works for field type text only) } function checkEmpty(formN, objvar){ var err = ""; var frmObj = eval("document." + formN); for(var i=0; i]*>/g; mContents = mContents.replace(re,""); if((mContents == "") || (mContents == " ")) { err += objvar.fieldV[i] + "\n"; } } if(objvar.fieldT[i] == "text"){ var frmElm = eval("frmObj." + objvar.fieldN[i]); if((frmElm.value == "") || (frmElm.value == " ")) { err += objvar.fieldV[i] + "\n"; }else if(objvar.fieldNM[i] == 1){ var chkInt = frmElm.value; if(isNaN(chkInt)){ err += objvar.fieldV[i] + " (Not a Number)\n"; } }else if(objvar.fieldC[i]){ var frmCElm = eval("frmObj." + objvar.fieldC[i]); if(frmElm.value != frmCElm.value){ err += objvar.fieldV[i] + " mismatch\n"; } }else if(objvar.fieldN[i].indexOf("email") >= 0){ if(!checkEmail(frmElm.value)) { err += objvar.fieldV[i] + " (Ung├╝ltige E-Mail)\n"; } }else if(objvar.fieldN[i].indexOf("url") >= 0){ if(!checkUrl(frmElm.value)) { err += objvar.fieldV[i] + " (Invalid URL)\n"; } }else if(objvar.fieldN[i].indexOf("website") >= 0){ if(!checkUrl(frmElm.value)) { err += objvar.fieldV[i] + " (Invalid URL)\n"; } }else if(objvar.fieldEQ[i]) { if(frmElm.value != objvar.fieldEQ[i]) { err += objvar.fieldV[i] + " (IInvalid entry)\n"; } }else if(objvar.fieldGT[i]) { if(frmElm.value <= objvar.fieldGT[i]) { err += objvar.fieldV[i] + " (Invalid entry)\n"; } }else if(objvar.fieldLT[i]) { if(frmElm.value >= objvar.fieldLT[i]) { err += objvar.fieldV[i] + " (Invalid entry)\n"; } }else if(objvar.fieldGE[i]) { if(frmElm.value < objvar.fieldGE[i]) { err += objvar.fieldV[i] + " (Invalid entry)\n"; } }else if(objvar.fieldLE[i]) { if(frmElm.value > objvar.fieldLE[i]) { err += objvar.fieldV[i] + " (Invalid entry)\n"; } }else if(objvar.fieldBT[i]) { var btSplit = new Array(); btSplit = objvar.fieldBT[i].split('|'); if(btSplit[0] > btSplit[1]) { var tmpSplit = btSplit[0]; btSplit[0] = btSplit[1]; btSplit[1] = tmpSplit; } if((frmElm.value < btSplit[0]) || (frmElm.value > btSplit[1])) { err += objvar.fieldV[i] + " (Invalid entry)\n"; } } } if(objvar.fieldT[i] == "checkbox"){ var frmElm = eval("frmObj." + objvar.fieldN[i]); if(frmElm.checked === false) { err += objvar.fieldV[i] + "\n"; } } if((objvar.fieldT[i] == "select")||(objvar.fieldT[i] == "mselect")){ var frmElm = document.getElementById(objvar.fieldI[i]); var selectedI = false; for(var j=0; j< frmElm.length; j++) { if(frmElm[j].selected == true) { selectedI = true; if(objvar.fieldT[i] == "select") { if((frmElm.value == "") || (frmElm.value == 0)){ selectedI = false; } } } } if(selectedI == false) { err += objvar.fieldV[i] + "\n"; } } if(objvar.fieldT[i] == "radio"){ var frmElm = eval("frmObj." + objvar.fieldN[i]); var checkedI = false; for(var j=0; j< frmElm.length; j++) { if(frmElm[j].checked == true) { checkedI = true; } } if(checkedI === false) { err += objvar.fieldV[i] + "\n"; } } } if(err != "") { var errShow = "Folgende Felder fehlen oder wurden nicht korrekt eingegeben: \n\n"; errShow += err; alert(errShow); return false; } return true; } function checkDate(frmname, dd,mm,yy){ frmobj = eval("document." + frmname); var day = parseInt(eval("frmobj." + dd + ".value"), 10); var month = parseInt(eval("frmobj." + mm + ".value"), 10); var year = parseInt(eval("frmobj." + yy + ".value"), 10); var checkLeep = year%4; if((checkLeep > 0) && (month == 2) && (day > 28)) { return false; } if((checkLeep == 0) && (month == 2) && (day > 29)) { return false; } if((day > 30) && ( (month == 4) || (month == 6) || (month == 9) || (month == 11))) { return false; } if(isNaN(day) || isNaN(month) || isNaN(year)) { return false; } return true; } function compareDate(frmname, cmpType, cmpStr, dd,mm,yy){ if(cmpType == 'BT') { var cmpSplit = new Array(); cmpSplit = cmpStr.split('|'); cmpStr = cmpSplit[0]; cmpStrEnd = cmpSplit[1]; dateSplitEnd = cmpStrEnd.split(','); var eday = parseInt(dateSplitEnd[0], 10); var emonth = parseInt(dateSplitEnd[1], 10); var eyear = parseInt(dateSplitEnd[2], 10); var empStr = eyear + "," + appendZero(emonth) + "," + appendZero(eday); empStr = empStr.replace(/,/g, ""); } var dateSplit = new Array(); dateSplit = cmpStr.split(','); var cday = parseInt(dateSplit[0], 10); var cmonth = parseInt(dateSplit[1], 10); var cyear = parseInt(dateSplit[2], 10); frmobj = eval("document." + frmname); var day = parseInt(frmobj.dd.value, 10); var month = parseInt(frmobj.mm.value, 10); var year = parseInt(frmobj.yy.value, 10); var cmpStr = cyear + "," + appendZero(cmonth) + "," + appendZero(cday); var curStr = year + "," + appendZero(month) + "," + appendZero(day); cmpStr = cmpStr.replace(/,/g, ""); curStr = curStr.replace(/,/g, ""); if(cmpType == 'EQ') { if(curStr != cmpStr) { return false; } } if(cmpType == 'GT') { if(curStr <= cmpStr) { return false; } } if(cmpType == 'LT') { if(curStr >= cmpStr) { return false; } } if(cmpType == 'GE') { if(curStr < cmpStr) { return false; } } if(cmpType == 'LE') { if(curStr > cmpStr) { return false; } } if(cmpType == 'BT') { if(cmpStr > empStr) { var tmpStr = cmpStr; cmpStr = empStr; empStr = tmpStr; } if((curStr < cmpStr) || (curStr > empStr)) { return false; } } return true; } function checkEmail(fieldValue){ var chkAt = fieldValue.indexOf("@"); var chkDot= fieldValue.indexOf("."); var chkHack= fieldValue.indexOf("@."); var chkHackA= fieldValue.indexOf(".@"); if((chkAt >= 0) && (chkDot >= 0) && (chkHack == -1) && (chkHackA == -1) ) { return true; } return false; } function checkUrl(fieldValue){ var chkAt = fieldValue.indexOf("@"); var chkDot= fieldValue.indexOf("."); if(fieldValue.length <= 8) { return false; } if((fieldValue.substr(0,7) == "http://") || (fieldValue.substr(0,8) == "https://")) { return true; } return false; } function appendZero(val){ var str = ""; str = '' + val + ''; if(str.length == 1) { str = "0" + str; } return str; } function ValidateOrder(frm) { var err = ""; if (document.reg_form.title.value.length==0) { err = err + "Anrede\n"; } if (document.reg_form.firstname.value.length==0) { err = err + "Vorname\n"; } if (document.reg_form.last_name.value.length==0) { err = err + "Nachname\n"; } // if (document.reg_form.street.value.length==0) { // err = err + "Straße\n"; // } if (document.reg_form.address1.value.length==0) { err = err + "PLZ / Ort\n"; } // if (document.reg_form.telephone.value.length==0) { // err = err + "Telefon\n"; // } if (document.reg_form.email.value.length==0) { err = err + "E-Mail\n"; }else{ if(!checkEmail(document.reg_form.email.value)) { err = err + 'Ung├╝ltige E-Mail'; err = err + "\n"; } } if(document.reg_form.is_member.checked){ if (document.reg_form.member_no.value.length==0) { err = err + "Mitgliedsnummer\n"; } } if (err.length>2) { errShow = "Folgende Felder fehlen oder wurden nicht korrekt eingegeben: \n"; alert(errShow + '' + err); return (false); }else{ return (true); } } function ValidateLogin(frm) { var err = ""; var frmObj=document.login; var str=document.getElementById('membno').value; if (document.getElementById('membno').value=="") { errShow = "Folgende Felder fehlen oder wurden nicht korrekt eingegeben: \n"; err = err + " Mitgliedsnummer\n"; alert(errShow + '' + err); return (false); } if(str.charAt(0)==='0'){ errShow = "Folgende Felder fehlen oder wurden nicht korrekt eingegeben: \n"; err = err + " Mitgliedsnummer\n"; alert(errShow + '' + err); return (false); } if(!(isInteger(document.getElementById('membno').value))){ errShow = "Folgende Felder fehlen oder wurden nicht korrekt eingegeben: \n"; err = err + " Mitgliedsnummer\n"; alert(errShow + '' + err); return (false); } if (err) { errShow = "Folgende Felder fehlen oder wurden nicht korrekt eingegeben: \n"; alert(errShow + '' + err); return (false); }else{ var price=document.getElementById('price').value; var res=confirm('Wollen Sie diesen Artikel wirklich '+ price +' kaufen?'); if(res){ return (true); }else{ return (false); } } } function isAlpha(str,len){ var re = /[^a-zA-Z]/g var i; for(i=0;i "9"))) return false; } // All characters are numbers. return true; }