ASP_msg_1 = "Il numero del bollettino deve essere di 18 cifre"; ASP_msg_2 = "Le prime 5 cifre devono essere degli zeri"; ASP_msg_3 = "Le ultime 2 cifre devono essere degli zeri"; ASP_msg_4 = "La sedicesima cifra deve essere 1, 2 o 3"; ASP_msg_5 = "Le prime 6 cifre devono essere degli zeri"; ASP_msg_6 = "I caratteri alfabetici [A-Z] non sono ammessi"; ASP_msg_7 = "Inserire l\'importo del versamento"; ASP_msg_8 = "Inserire un importo valido del versamento"; ASP_msg_9 = "Inserire il nominativo del trasgressore"; ASP_msg_10 = "Inserire il ????"; ASP_msg_11 = "Inserire la ????"; ASP_msg_12 = "La ???? è errata"; ASP_msg_13 = "Inserire la targa"; ASP_msg_14 = "Il ???? è errato"; ASP_msg_15 = "Le ultime due cifre del ???? sono sbagliate"; arrTipoDoc = "Verbale;Notifica;Procedimento".split(";"); arrNumTipoDoc = "Numero Verbale;Numero Notifica;Numero Procedimento".split(";"); arrDataTipoDoc = "Data Verbale;Data Notifica;Data Procedimento".split(";"); function verificaFormBollettino(formAF) { switch(formAF.ONCE.value) { case "": case "0": if(!verificaNumeroBollettino(formAF)){ return false; } break; case "1": ASP_msg_10 = ASP_msg_10.replace("????", arrNumTipoDoc[formAF.TIPODOC.value - 1]); ASP_msg_11 = ASP_msg_11.replace("????", arrDataTipoDoc[formAF.TIPODOC.value - 1]); ASP_msg_12 = ASP_msg_12.replace("????", arrDataTipoDoc[formAF.TIPODOC.value - 1]); ASP_msg_14 = ASP_msg_14.replace("????", arrNumTipoDoc[formAF.TIPODOC.value - 1]); ASP_msg_15 = ASP_msg_15.replace("????", arrNumTipoDoc[formAF.TIPODOC.value - 1]); if(!verificaDati(formAF)){ return false; } break; } return true; } function verificaNumeroBollettino(formAF) { if (formAF.ONCE.value == "0" || formAF.ONCE.value == "" ) { formAF.TIPODOC.value = ""; } var nbol = formAF.numeroBollettino.value; if (nbol.length!=18) { alert(ASP_msg_1); return false; } /* RDV_1114 if (nbol.substr(16,2) != "00") { alert(ASP_msg_3); return false; }*/ if (isNaN(nbol)) { alert(ASP_msg_6); return false; } var nTipoDoc = parseInt(nbol.substr(15,1)); switch(nTipoDoc) { case 1: if(nbol.substr(0,5) != "00000") { alert(ASP_msg_2); return false; } break; case 2: /* EQ 17/12/2009 tolto il controllo sulle 6 cifre. Polenta ha detto che si possono pagare. Il controllo solo sui primi 5 zeri */ case 3: if(nbol.substr(0,5) != "00000") { alert(ASP_msg_5); return false; } break; default: alert(ASP_msg_4); return false; } formAF.TIPODOC.value = nTipoDoc; if (formAF.ONCE.value == "") { formAF.ONCE.value = "1"; } return true; } function verificaDati(formAF) { if(formAF.prezzoIntero.value == "" || formAF.prezzoIntero.value == "0" ){ alert(ASP_msg_7); formAF.prezzoIntero.focus(); return false; } if(isNaN(formAF.prezzoIntero.value)){ alert(ASP_msg_8); formAF.prezzoIntero.focus(); return false; } if(formAF.trasgressore.value.trim() == ""){ alert(ASP_msg_9); formAF.trasgressore.focus(); return false; } /* if(formAF.numeroVerbale.value == ""){ alert(ASP_msg_10); formAF.numeroVerbale.focus(); return false; } */ if(formAF.dataCDS.value.trim() == ""){ alert(ASP_msg_11); formAF.dataCDS.focus(); return false; } if(!validazioneData(formAF.dataCDS)){ alert(ASP_msg_12); return false; } if(formAF.targa.value.trim() == ""){ alert(ASP_msg_13); formAF.targa.focus(); return false; } //var lunghezzaVerbale = (formAF.TIPODOC.value == "1" ) ? 8 : 10; //8 : 9; //Verbale lungo 8 altrimenti 10 //var partenzaVerbale = 6; //(formAF.TIPODOC.value == "1" ) ? 5 : 6; //var strappo= "00000000000" + formAF.numeroBollettino.value.substr(partenzaVerbale,lunghezzaVerbale); //var appoboll=""; //appoboll = strappo.slice(strappo.length-11); //if(formAF.numeroVerbale.value != appoboll) { // alert(ASP_msg_14); // formAF.numeroVerbale.focus(); // return false; //} return true; } String.prototype.trim = function(){ // Use a regular expression to replace leading and trailing // spaces with the empty string return this.replace(/(^\s*)|(\s*$)/g, ""); } function getCalendar(idOggetto){ window.open("tools/Calendar.asp?idOggetto=" + idOggetto, "", "left=600,top=200,height=250,width=250,status=no,location=no,menubar=no,scrollbar=no,titlebar=no"); } function formattanumberZERI() { var str= "00000000000" + bollettino.numeroVerbale.value; //alert(str.slice(str.length-11)); bollettino.numeroVerbale.value = str.slice(str.length-11); }