// ------------------------------------------------- // Controllo campi nel form di registrazione // ------------------------------------------------- function vregistration(f) { var msg = ""; if (f.Password.value == "") msg += "- Immettere una password\n"; if (f.Email.value == "") msg += "- Immettere l'indirizzo email\n"; if (f.QAnno.value.length != 4 && f.QAnno.value.length > 0) msg += "- Indicare l'anno di nascita a 4 cifre\n"; if (msg != "") { alert ("Attenzione:\n\n" +msg); return false; } } // ------------------------------------------------- // Controllo campi nel form di registrazione // ------------------------------------------------- function vregistration01(f) { var msg = ""; if (f.Password.value == "") msg += "- Immettere una password\n"; if (f.Email.value == "") msg += "- Immettere l'indirizzo email\n"; if (msg != "") { alert ("Attenzione:\n\n" +msg); return false; } } // ------------------------------------------------- // Controllo campi nel form edit ricetta // ------------------------------------------------- function vricetta(f) { document.getElementById('bsubmit').disabled=true; var msg = ""; if (f.Titolo.value == "") msg += "TITOLO\n"; if (f.Categoria.selectedIndex == -1) msg += "CATEGORIA\n"; if (msg != "") { alert ("I seguenti campi devono essere compilati:\n\n" +msg); document.getElementById('bsubmit').disabled=false; return false; } } // ------------------------------------------------- // Controllo campi nel form edit locale // ------------------------------------------------- function vlocale(f) { var msg = ""; if (f.Descrizione.value.length < 99) { alert ("Immettere una descrizione un po' più lunga (almeno 100 caratteri).\nQuello che hai scritto è lungo " + f.Descrizione.value.length + " caratteri.\n"); return false; } if (f.Titolo.value == "") msg += "NOME DEL LOCALE\n"; if (f.Provincia.selectedIndex == 0) msg += "PROVINCIA\n"; if (f.Categoria.selectedIndex == 0) msg += "CATEGORIA\n"; if (RadioCheck(f.Prezzo)) msg += "PREZZO\n"; if (RadioCheck(f.Utilizzo)) msg += "ADATTO PER\n"; if (RadioCheck(f.QOS)) msg += "QUALITA' DEL SERVIZIO\n"; if (RadioCheck(f.Voto)) msg += "GIUDIZIO COMPLESSIVO\n"; if (msg != "") { alert ("I seguenti campi devono essere compilati:\n\n" +msg); return false; } } // ------------------------------------------------- // Controllo campi nel form edit consiglio // ------------------------------------------------- function vconsiglio(f) { var msg = ""; if (f.Titolo.value == "") msg += "TITOLO\n"; if (RadioCheck(f.Tipo)) msg += "CATEGORIA\n"; if (msg != "") { alert ("I seguenti campi devono essere compilati:\n\n" +msg); return false; } } // ------------------------------------------------- // Controllo campi nel form edit annuncio // ------------------------------------------------- function vannuncio(f) { var msg = ""; if (RadioCheck(f.Tipo)) msg += "TIPO\n"; if (f.Categoria.selectedIndex == 0) msg += "CATEGORIA\n"; if (f.Descrizione.value == "") msg += "TESTO ANNUNCIO\n"; if (msg != "") { alert ("I seguenti campi devono essere compilati:\n\n" +msg); return false; } } // ------------------------------------------------- // Controllo campi nel form Sondaggio // ------------------------------------------------- function vsondaggio(f) { var msg = ""; if (RadioCheck(f.Risposta)) msg += "Indicare almeno una risposta"; if (msg != "") { alert (msg); return false; } } // ------------------------------------------------- // Controllo campi nel sondaggio // ------------------------------------------------- function vsondaggio(f) { var msg = ""; if (f.Titolo.value == "") msg += "TITOLO\n"; if (msg != "") { alert ("I seguenti campi devono essere compilati correttamente:\n\n" +msg); return false; } } // ------------------------------------------------- // Controllo campi nel form dirsearch // ------------------------------------------------- function vdirsearch(f) { var msg = ""; if (f.keywords.value == "") msg += "PAROLA CHIAVE\n"; if (msg != "") { alert ("I seguenti campi devono essere compilati:\n\n" +msg); return false; } } // ------------------------------------------------- // Controllo campi invia documento per email // ------------------------------------------------- function vsendto(f) { var msg = ""; if (f.Mittente.value == "") msg += "IL TUO NOME\n"; if (AddressCheck(f.ReplyTo) == false) msg += "IL TUO INDIRIZZO EMAIL\n"; if (f.Destinatario.value == "") msg += "NOME DESTINATARIO\n"; if (AddressCheck(f.SendTo) == false) msg += "INDIRIZZO EMAIL DESTINATARIO\n"; if (msg != "") { alert ("I seguenti campi devono essere compilati correttamente:\n\n" +msg); return false; } } // ------------------------------------------------- // Controllo campi query // ------------------------------------------------- function vquery(f) { var msg = ""; if (f.Query.value == "") msg += "Attenzione: immetti almeno una parola da cercare\n"; if (msg != "") { alert (msg); return false; } } // ------------------------------------------------- // Controllo campi cartella preferite // ------------------------------------------------- function vcartella(f) { var msg = ""; if (f.Titolo.value == "") msg += "Attenzione: il nome della cartella e` obbligatorio\n"; if (f.Titolo.value.length>20) msg += "Attenzione: la lunghezza del nome non puo` superare i 20 caratteri e tu ne hai usati " + f.Titolo.value.length; if (msg != "") { alert (msg); return false; } } // ------------------------------------------------- // Controllo campi modulo ordine // ------------------------------------------------- function vordine(f) { var msg = ""; if (f.Nome.value == "") msg += "- Nome o Ragione Sociale\n"; if (f.Indirizzo.value == "") msg += "- Indirizzo\n"; if (f.Cap.value == "") msg += "- CAP\n"; if (f.Localita.value == "") msg += "- Comune\n"; // if (f.Provincia.value.length == 0) msg += "- Provincia\n"; if (f.CodiceFiscale.value == "") msg += "- Codice Fiscale o Partita IVA\n"; if (AddressCheck(f.Email) == false) msg += "- Indirizzo Email\n"; if (RadioCheck(f.TipoPagamento)) msg += "- Tipo di pagamento\n"; if (msg != "") { alert ("I seguenti campi devono essere compilati:\n\n" +msg); return false; } return true; } // ------------------------------------------------- // Controllo campi Perle (Forum) // ------------------------------------------------- function vperla(f) { var msg = ""; if (f.PerlaTitolo.value == "") msg += "- Titolo\n"; if (f.PerlaCategoria.selectedIndex == 0) msg += "- Categoria\n"; if (f.PerlaCapitolo.options[f.PerlaCapitolo.selectedIndex].text == "" && f.PerlaCapitolo2.value == "") msg += "- Capitolo\n"; if (msg != "") { alert ("I seguenti campi devono essere compilati:\n\n" +msg); return false; } return true; } // ------------------------------------------------- // varie // ------------------------------------------------- function RadioCheck(f){ ok = true; for ( i = 0; i < f.length; i ++) { if (f[i].checked == true) { ok = false; } } return ok; } // ------------------------------------------------- // Check Email Address // ------------------------------------------------- function AddressCheck(f){ var ok = true; var test = f.value.indexOf('@', 0); if (f.value.length == 0 || f.value.indexOf('@', 0) == -1 || f.value.indexOf('.', test) == -1) ok = false; return ok; }