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 += '- Name\n'; ook=false; }; if (m.realname.value=="") { errors+='- Surname\n'; ook=false; }; if (!checkEmail(m.email.value)) { errors+='- Please insert a valid email address\n'; ook=false; }; var trattDati = null; if (m.tratt_dati == undefined) { trattDati = m.Privacy; } else { trattDati = m.tratt_dati; } if (!(trattDati.checked)) { errors+='\n'+'- Privacy policy is required\n'; ook=false; }; if (!ook) { alert('The following fields are required:\n\n'+errors); } return ook; }