// JavaScript Document

function isEmail(string) {
if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true;
else
return false;
}

function verifica() //controlla se un textbox è vuoto
{
var frm=document.iscrizione;
var errors="";
if (frm.titolo.value=='') {
errors=errors+"- Il titolo è obbligatorio.\n";
}
if (frm.ind.value=='') {
errors=errors+"- L'indirizzo è obbligatorio.\n";
}
if (frm.citta.value=='') {
errors=errors+"- La città è obbligatoria.\n";
}
if (frm.cap.value=='') {
errors=errors+"- Il CAP è obbligatorio.\n";
}
if (isNaN(frm.cap.value)){
errors=errors+"- Inserire il cap in modo corretto.\n";
}
if (frm.prov.value=='') {
errors=errors+"- La provincia è obbligatoria.\n";
}
if (frm.nazione.value=='') {
errors=errors+"- La nazione è obbligatoria.\n";
}
if (frm.tel1.value=='') {
errors=errors+"- Il telefono è obbligatorio.\n";
}
if (isNaN(frm.tel1.value)){
errors=errors+"- Inserire il telefono in modo corretto.\n";
}
if (!isEmail(frm.email.value)) {
errors=errors+"- L'email non è valida.\n";
}
if (!frm.chkATD.checked) {
errors=errors+"- Autorizzazione trattamento dati personali\n";
}
if (errors) {
alert("I dati forniti non sono completi:\n"+errors);
return false;
}
else {
return true;
}
return 0;
}
//}-->

function verifica_evento() //controlla se un textbox è vuoto
{
var frm=document.iscrizione;
var errors="";
if (frm.evento.value=='') {
errors=errors+"- L'evento è obbligatorio.\n";
}
if (frm.nome.value=='') {
errors=errors+"- Il nome è obbligatorio.\n";
}
if (frm.cognome.value=='') {
errors=errors+"- Il cognome è obbligatorio.\n";
}
if (frm.citta.value=='') {
errors=errors+"- La città è obbligatoria.\n";
}
if (frm.cap.value=='') {
errors=errors+"- Il CAP è obbligatorio.\n";
}
if (isNaN(frm.cap.value)){
errors=errors+"- Inserire il cap in modo corretto.\n";
}
if (frm.prov.value=='') {
errors=errors+"- La provincia è obbligatoria.\n";
}
if (frm.nazione.value=='') {
errors=errors+"- La nazione è obbligatoria.\n";
}
if (frm.tel.value=='') {
errors=errors+"- Il telefono è obbligatorio.\n";
}
if (isNaN(frm.tel.value)){
errors=errors+"- Inserire il telefono in modo corretto.\n";
}
if (!isEmail(frm.email.value)) {
errors=errors+"- L'email non è valida.\n";
}
if (!frm.chkATD.checked) {
errors=errors+"- Autorizzazione trattamento dati personali\n";
}
if (errors) {
alert("I dati forniti non sono completi:\n"+errors);
return false;
}
else {
return true;
}
return 0;
}
//}-->
