function checkEmail(str){ var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if (filter.test(str)){ return true; }else{ return false; } } function subme(m) { var errors=''; ook=true; if (m.firstname.value=="") { errors += '- Nome\n'; ook=false; }; if (m.realname.value=="") { errors+='- Cognome\n'; ook=false; }; if (!checkEmail(m.email.value)) { errors+='- Inserire un indirizzo E-mail valido\n'; ook=false; }; var trattDati = null; if (m.tratt_dati == undefined) { trattDati = m.Privacy; } else { trattDati = m.tratt_dati; } if (!(trattDati.checked)) { errors+='\n'+'E' necessario acconsentire al trattamento di dati personali\n'; ook=false; }; if (!ook) { alert('Attenzione: i seguenti campi sono obbligatori\n\n'+errors); } return ook; }