function ltrim(argvalue) { while (1) { if (argvalue.substring(0, 1) != " ") break; argvalue = argvalue.substring(1, argvalue.length); } return argvalue; } function emailCheck(emailStr) { var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i if (filter.test(emailStr)) testresults=true else testresults=false return (testresults) } function emailCheckTmp (emailStr) { /*user@domain format separate the username from the domain.*/ var emailPat=/^(.+)@(.+)$/; var specialChars="\\(\\)<>@;:\\\\\\\"\\.\\[\\]"; /*unvalid chars in username or domainname*/ var validChars="\[^\\s" + specialChars + "\]"; /*E.g. "jiminy cricket"@disney.com*/ var quotedUser="(\"[^\"]*\")"; /*IP addresses joe@[123.124.233.4]*/ var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; /*atom (basically a series of non-special characters.)*/ var atom=validChars + '+'; /*a word is either an atom or quoted string.*/ var word="(" + atom + "|" + quotedUser + ")"; /*The following pattern describes the structure of the user*/ var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); /*normal symbolic domain, as opposed to ipDomainPat, shown above.*/ var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); // Adding multi-email support emailArr = emailStr.split( "," ); emailCount = 0; while( emailCount < emailArr.length ) { curMail = ltrim( emailArr[ emailCount ] ); var matchArray=curMail.match(emailPat); if (matchArray==null) { return false; } var user=matchArray[1]; var domain=matchArray[2]; if (user.match(userPat)==null) { return false; } var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { /* this is an IP address*/ for (var i=1;i<=4;i++) { if (IPArray[i]>255) { return false; } } return true; } var domainArray=domain.match(domainPat); if (domainArray==null) { return false; } var atomPat=new RegExp(atom,"g"); var domArr=domain.match(atomPat); var len=domArr.length; if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) { return false; } if (len<2) { return false; } emailCount++; } return true; } /********************************************************************************************************/ /* End of email check*/ /********************************************************************************************************/ function getValue(){ switch(thisField.type){ case 'select-one':{ return thisField.options[thisField.selectedIndex].value; } case 'select-multiple':{ if(thisField.selectedIndex > -1){ return thisField.options[thisField.selectedIndex].value; }else{ return ""; } } default:{ return thisField.value; } } } /********************************************************************************************************/ function isBlank(thisVal){ val = thisVal!=null?thisVal:getValue(); var thisType = thisVal!=null?'':thisFieldDef.type; if(thisType=="Checkbox"||thisType=="Radio"){ var blank = true; var currField = formNo var thisFieldTmp = thisField var name = thisFieldTmp.name; while(thisFieldTmp.name==name){ blank = blank && (!thisFieldTmp.checked); currField++; thisFieldTmp = thisForm.elements[currField]; } return blank; }else{ for(j=0;j= val}; return (min && max); } return false; } /********************************************************************************************************/ function isCreditcardNumber(thisVal){ var val = thisVal?thisVal:getValue(); } var thisField=null; var thisFieldDef=null; var thisForm=null; /********************************************************************************************************/ function verify(form){ thisForm = form; var errorMsg = ''; formNo=0; tmp='' formAliasTX = form.allFields.getObj("name","FormAliasTX") //images = eval(formAliasTX.docPath+'document.images'); formOtherValues = formAliasTX.otherValues //mandatoryWrongPicture = form.allFields.getObj("name","FormAliasTX").otherValues.pictureMandatoryWrong; //mandatoryPicture = form.allFields.getObj("name","FormAliasTX").otherValues.pictureMandatory; for(i=0;i' // --- START Generating values --- thisValue = thisValue.replace(/&/g,'&') if(thisFieldDef.type=='ExpandingCategories'){ thisValue=''+thisValue.replace(//g,'"').replace(//g,"'").replace(/~/g,'')+'' }else{ thisValue=''+thisValue.replace(//g,'>').split('~').join('').replace(/\n/g,'
').replace(/\r/g,'') +'
' } // --- END Generating values --- // --- START Inserting the field in the all forms structure --- fieldAttributes=' pushmail="'+(thisFieldDef.pushMail!=null?thisFieldDef.pushMail:'') +'" type="'+(thisFieldDef.type!=null?thisFieldDef.type:'') +'" description="'+(thisFieldDef.description!=null?thisFieldDef.description:'').replace(/&/g,'&').replace(//g,'>') +'" publicField="'+(thisFieldDef.publicField!=null?thisFieldDef.publicField:'') +'" '+thisFieldDef.fieldXMLAttributes // // --- Setting the XML attributes for this field --- currentForm = allForms.getObj('formAlias',thisFormAlias) if(currentForm){ currentForm.allValues += ''+thisAlias+thisValue+ '' }else{ var newForm = {formAlias:thisFormAlias,allValues:''} position = allForms.length allForms[position] = newForm allForms[position].allValues = ''+thisAlias+thisValue+ '' } // --- END Inserting the field in the all forms structure --- } // --- END Creating XML --- thisValue='' thisAlias='' } formNo+=(thisFieldDef.type=="Checkbox"||thisFieldDef.type=="Radio")?thisFieldDef.values.length:1; } // --- START Merging all forms to one XML-string --- for(var i=0;i' + allForms[i].allValues + '' } // --- END Merging all forms to one XML-string --- // --- START Finding the last field named 'OtherFieldsValueTX' and inserting the XML-string --- for(var i=form.length-1;i>=0;i--){ thisField = form.elements[i]; if (thisField.name=="OtherFieldsValueTX"){ if(!isBlank(allValues)){ thisField.value=''+allValues+'' // --- START DEBUGGING: Writing output html to a new window --- if((bw.ns4||bw.ns5)&&false){ var ewin = window.open("", "EventTester","width=300,height=600,scrollbars,resizable,menubar"); var d = ewin.document; d.open("text/plain"); d.writeln(thisField.value); } // --- END DEBUGGING: Writing output html to a new window --- } thisField.checked=true break; } } // --- END Finding the last field named 'OtherFieldsValueTX' and inserting the XML-string --- }