devi usare una funzione che verifichi i diversi campi del tuo form...
ad esempio così...
codice:
<script language="javascript">
<!--
function Modulo() {
// Variabili associate ai campi del modulo
var email = document.modulo.email.value;
var username = document.modulo.username.value;
var password = document.modulo.password.value;
var cellulare = document.modulo.cellulare.value;
var cognome = document.modulo.cognome.value;
var nome = document.modulo.nome.value;
var accetto2 = document.modulo.accetto2.value;
//Effettua il controllo sul campo email
if((email == "") || (email == "undefined")) {
alert("Il campo email è obbligatorio.");
document.modulo.email.focus();
return false;
}
//Effettua il controllo sul campo username
else if ((username == "") || (username == "undefined")) {
alert("Il campo username è obbligatorio.");
document.modulo.username.focus();
return false;
}
//Effettua il controllo sul campo password
else if((password == "") || (password == "undefined")) {
alert("Il campo password è obbligatorio.");
document.modulo.password.focus();
return false;
}
//Effettua il controllo sul campo cellulare
else if((cellulare == "") || (cellulare == "undefined")) {
alert("Il campo cellulare è obbligatorio.");
document.modulo.cellulare.focus();
return false;
}
//Effettua il controllo sul campo cellulare
else if((cognome == "") || (cognome == "undefined")) {
alert("Il campo cognome è obbligatorio.");
document.modulo.cognome.focus();
return false;
}
else if((nome == "") || (nome == "undefined")) {
alert("Il campo nome è obbligatorio.");
document.modulo.nome.focus();
return false;
}
else if(document.modulo.accetto2.checked == false)
{ alert("il consenso privacy è obbligatorio");
document.modulo.accetto2.checked();
document.modulo.accetto2.focus();
return false;
}
}
//-->
</script>