ecco qui lo script:
codice:
function verifica(modulo){
w_giorno=parseInt(modulo.giorno.value);
w_mese=parseInt(modulo.mese.value);
w_votazione=parseInt(modulo.votazione.value);
errore=false;
if ((w_giorno<1) || (w_giorno>31)) errore = true;
if ((w_mese<1) || (w_mese>12)) errore = true;
if ((w_votazione<18) || (w_votazione>30)) errore = true;
if(errore==true){
alert("errore nell'inserimento dei dati");
return false;
}
}
e qui c'è il form:
codice:
<form action="/lab_project/servletsweb" onsubmit="return verifica(this);" method="POST">
Matricola: <jsp:getProperty name="docente" property="studenteiscr"/></p>
Corso: <jsp:getProperty name="docente" property="appelli_fiss"/></p>
Appello del: <input type="text" name="giorno" value="" size="3" />/<input type="text" name="mese" value="" size="3" /> (dd/mm)</p>
Votazione: <input type="text" name="votazione" value="" size="3" />/30</p>
<input type="submit" value="assegna voto" name="votazione" /></p>
</form>