function richiediAccount(){ //alert("Richiedo account") var f=window.document.forms[0]; var is_error,cErrors='',fErrors= '',primo=''; var elementoVerified = document.querySelector('[name="captcha_verified"]'); var isVerified = elementoVerified ? elementoVerified.value : "0"; if (isVerified !== "1") { var risp = window.confirm('Confermi la richiesta di password e/o utente a Gilbarco Veeder-Root?'); if (!(risp)) return(false); } var obj= eval ("document.getElementById('frichiesta')"); var theField= eval ("document.forms[0].frichiesta"); var tipo=getFieldValue (obj, theField); if (tipo==''){ alert("Selezionare il tipo richiesta.") return false; } if (tipo=='Password'){ //T=testo,N=numerico,E=email,PC=partita iva o codice fiscale,CAP=codice postale,D=data //O=obbligatorio, F=facoltativo item_list = [ ['ftipo_utente',"Categoria utente","T","O"], ['fnome_utente',"Nome utente","T","O"], ['femail',"Email","E","F"] ]; }else{ item_list = [ ['ftipo_utente',"Categoria utente","T","O"], ['fnome', "Nome","T","O"], ['fcognome', "Cognome","T","O"], ['femail',"Email","E","F"] ]; } //alert("Valido i campi") for ( i= 0; i < item_list.length; i++ ){ //alert(item_list[i][0]) var trovato=0; is_error= 0; var obj= eval ("document.getElementById('" + item_list[i][0] + "')"); if (typeof(obj) != 'object') continue; var theField= eval ("document.forms[0]." + item_list[i][0]); var theValue=getFieldValue (obj, theField ); //alert(item_list[i][0]+"="+theValue); if (obj.disabled){ switch (obj.type){ case 'radio': case 'checkbox': obj.style.backgroundColor='transparent'; break; default: obj.style.backgroundColor='#FFFFFF'; } continue; } var noBlank= item_list[i][3]; if (noBlank == 'O'){ if (trim(theValue) == '') is_error = 1; if (typeof(obj.style)== 'object'){ switch (obj.type){ case 'radio': case 'checkbox': obj.style.backgroundColor=is_error > 0?'#FFCC66':'transparent'; break; default: obj.style.backgroundColor=is_error > 0?'#FFCC66':'#FFFFFF'; } } cErrors += (is_error > 0) ? '\n- ' + item_list[i][1]:''; primo += ((theField.type=='text') && (is_error > 0) && (primo=='')) ? item_list[i][0]:''; } var tipo= item_list[i][2]; if (!StringaVuota(theValue)){ switch (tipo){ case 'E': if (!indirizzoEmailValido(theValue)) is_error = 1; break; default: } if (typeof(obj.style)== 'object'){ switch (obj.type){ case 'radio': case 'checkbox': obj.style.backgroundColor=is_error > 0?'#6E89DD':'transparent'; break; default: obj.style.backgroundColor=is_error > 0?'#6E89DD':'#FFFFFF'; } } fErrors += (is_error > 0)?'\n- ' + item_list[i][1]:''; primo += ((theField.type=='text') && (is_error > 0) && (primo=='')) ? item_list[i][0]:''; } } //alert("Fine valido i campii") //alert(cErrors); cErrors = cErrors == '' ? '':"Per favore riempire i campi seguenti:" + cErrors; cErrors += cErrors == ''?'':'\n'; fErrors = fErrors == ''?'':"Per favore correggere i campi seguenti:" + fErrors; fErrors += fErrors == ''?'':'\n'; is_error= ''; if (cErrors != '' || fErrors != ''){ alert(cErrors+'\n'+fErrors); if (! primo==''){ var theField=eval ("document.forms[0]." + primo); theField.focus(); theField.select(); } return false; } // ========================================== // INSERIMENTO CONTROLLO CLOUDFLARE TURNSTILE // ========================================== //Verifichiamo se il modulo è già stato validato dal Worker if (isVerified !== "1") { cloudflareCheck(f); return false; } f.submit(); } function abilitaCampi(){ var obj= eval ("document.getElementById('frichiesta')"); var theField= eval ("document.forms[0].frichiesta"); var tipo=getFieldValue (obj, theField); if (tipo=='Password'){ field_list_En=[ ['fnome_utente'] ]; field_list_De=[ ['fragione_sociale'], ['fnome'], ['fcognome'] ]; for ( i= 0; i < field_list_En.length; i++ ){ var theField= eval ("document.forms[0]." + field_list_En[i][0]); disable_field(theField,false) } for ( i= 0; i < field_list_De.length; i++ ){ var theField= eval ("document.forms[0]." + field_list_De[i][0]); theField.value=''; disable_field(theField,true) } eval ("document.forms[0].fnome_utente").focus(); }else{ field_list_De=[ ['fnome_utente'] ]; field_list_En=[ ['fragione_sociale'], ['fnome'], ['fcognome'] ]; for ( i= 0; i < field_list_En.length; i++ ){ var theField= eval ("document.forms[0]." + field_list_En[i][0]); disable_field(theField,false) } for ( i= 0; i < field_list_De.length; i++ ){ var theField= eval ("document.forms[0]." + field_list_De[i][0]); theField.value='' disable_field(theField,true) } eval ("document.forms[0].fragione_sociale").focus(); } return true; } function loadField(){ var obj= eval ("document.getElementById('frichiesta')"); var theField= eval ("document.forms[0].frichiesta"); var tipo=getFieldValue (obj, theField); switch (tipo){ case 'Password': field_list=[ ['fragione_sociale'], ['fnome'], ['fcognome'] ]; break; case 'Utente e password': field_list=[ ['fnome_utente'] ]; break; default: field_list=[ ['fnome_utente'], ['fragione_sociale'], ['fnome'], ['fcognome'] ]; } for ( i= 0; i < field_list.length; i++ ){ var theField= eval ("document.forms[0]." + field_list[i][0]); disable_field(theField,true) } } //Gestisce il click sul tasto ENTER per tutte le viste function keyDown(e) { var strin=""; //alert("keyDown") if (abilitato==3) { //var ns4=1; var nKey=e.which; var ieKey=0; var realkey = String.fromCharCode(e.which); strin=nKey } if (abilitato==4) { //var ns4=0; var ieKey=event.keyCode; var nKey=0; var realkey = String.fromCharCode(event.keyCode); strin=ieKey } if (strin=="13"){ richiediAccount(); }else{ return true; } } //Fine gestisce il click sul tasto ENTER per tutte le viste