sto cercando di ottenere tre cose
a) controllare i campi...e sin qui...bene
b) inviare il modulo alla mia e-mail
c) passare alla seconda pagina del form
VVoVe:
vi prego aiuto!!!
//questo è lo script://
<script language="javascript">
<!--
function Modulo() {
// Variabili associate ai campi del modulo
var nome = document.modulo.nome.value;
var cognome = document.modulo.cognome.value;
var citta = document.modulo.citta.value;
var nazione = document.modulo.nazione.value;
var nascita = document.modulo.nascita.value;
var telefono = document.modulo.telefono.value;
var email = document.modulo.email.value;
var homepage = document.modulo.homepage.value;
// Espressione regolare dell'email
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
//Effettua il controllo sul campo NOME
if ((nome == "") || (nome == "undefined")) {
alert("Il campo Nome è obbligatorio.");
document.modulo.nome.focus();
return false;
}
//Effettua il controllo sul campo COGNOME
else if ((cognome == "") || (cognome == "undefined")) {
alert("Il campo Cognome è obbligatorio.");
document.modulo.cognome.focus();
return false;
}
//Effettua il controllo sul campo CITTA'
else if ((citta == "") || (citta == "undefined")) {
alert("Il campo Città è obbligatorio.");
document.modulo.citta.focus();
return false;
}
//Effettua il controllo sul campo NAZIONE
else if ((nazione == "") || (nazione == "undefined")) {
alert("Il campo NAZIONE è obbligatorio.");
document.modulo.nazione.focus();
return false;
}
else if (isNaN(telefono)) {
alert("il campo telefono richiede valori numerici");
return false;
}
//controllo e-mail
else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
alert("Inserire un indirizzo e-mail corretto.");
document.modulo.email.select();
return false;
}
//Effettua il controllo sul campo HOMEPAGE
else if ((homepage == "") || (homepage == "undefined") || (homepage.indexOf("http://") == (-1))) {
alert("Il campo Homepage non può essere privo di http://");
document.modulo.homepage.value = "http://";
document.modulo.homepage.select();
return false;
}
//Effettua il controllo sul campo DATA DI NASCITA
else if (document.modulo.nascita.value.substring(2,3) != "/" ||
document.modulo.nascita.value.substring(5,6) != "/" ||
isNaN(document.modulo.nascita.value.substring(0,2) ) ||
isNaN(document.modulo.nascita.value.substring(3,5) ) ||
isNaN(document.modulo.nascita.value.substring(6,10 ))) {
alert("Inserire nascita in formato gg/mm/aaaa");
document.modulo.nascita.value = "";
document.modulo.nascita.focus();
return false;
}
else if (document.modulo.nascita.value.substring(0,2) > 31) {
alert("Impossibile utilizzare un valore superiore a 31 per i giorni");
document.modulo.nascita.select();
return false;
}
else if (document.modulo.nascita.value.substring(3,5) > 12) {
alert("Impossibile utilizzare un valore superiore a 12 per i mesi");
document.modulo.nascita.value = "";
document.modulo.nascita.focus();
return false;
}
else if (document.modulo.nascita.value.substring(6,10) < 1900) {
alert("Impossibile utilizzare un valore inferiore a 1900 per l'anno");
document.modulo.nascita.value = "";
document.modulo.nascita.focus();
return false;
}
//INVIA IL MODULO
else {
document.modulo.action = "modulo1.htm";
document.modulo.submit();
}
}
//-->
</script>
//questo è il form//
<form name="modulo" enctype="text/plain" method="post" action="mailto:l.lopresti@artbook.net" >
<tr><td height="20" colspan="2" align="center" valign="top"><div align="right">
</div></td>
</tr> <tr>
<td height="150" colspan="2" align="center"><div align="left">
p>* campo obbligatorio </p>
</div></td></tr> <tr>
<td width="525" height="27" bgcolor="#F0F5FB">
Nome*</p></td>
<td width="149" bgcolor="#F0F5FB">
<input type="text" name="nome">
</p></td>
</tr>
<tr>
<td height="27" bgcolor="#F2F2F2">
Cognome*</p></td>
<td bgcolor="#F2F2F2">
<input type="text" name="cognome">
</p></td>
</tr>
<tr bgcolor="#F0F5FB">
<td height="27">
Ragione sociale </p></td>
<td>
<input type="text" name="ragsoc">
</p></td>
</tr>
<tr bgcolor="#F2F2F2">
<td height="27">
Possiede partita iva?</p></td>
<td>
<input name="radiobutton" type="radio" value="radiobutton">
si
<input name="radiobutton" type="radio" value="radiobutton">
no </p></td>
</tr>
<tr bgcolor="#F0F5FB">
<td height="27">
Città*</p></td>
<td>
<input type="text" name="citta">
</p></td>
</tr>
<tr bgcolor="#F2F2F2">
<td height="27">
Nazione*</p></td>
<td>
<input type="text" name="nazione">
</p></td>
</tr>
<tr bgcolor="#F0F5FB">
<td height="27">
Telefono</p></td>
<td>
<input type="text" name="telefono">
</p></td>
</tr>
<tr bgcolor="#F2F2F2">
<td height="27">
Fax</p></td>
<td>
<input name="fax" type="text" id="fax">
</p></td>
</tr>
<tr bgcolor="#F0F5FB">
<td height="27">
Cellulare</p></td>
<td>
<input name="cellulare" type="text" id="cellulare">
</p></td>
</tr>
<tr bgcolor="#F2F2F2">
<td height="27">
e-mail*</p></td>
<td>
<input type="text" name="email">
</p></td>
</tr>
<tr bgcolor="#F0F5FB">
<td height="27">
URL </p></td>
<td>
<input type="text" name="homepage" value="http://">
</p></td>
<tr bgcolor="#F2F2F2">
<td height="27">
Data di nascita (es: gg/mm/aaaa)*</p></td>
<td>
<input type="text" name="nascita">
</p></td>
</tr><tr>
<td colspan="2" align="right"> </td>
</tr> <tr>
<td colspan="2" align="right"><input type="reset" value="cancella modulo" name="B2">
<input name="avanti" type="submit" onClick="Modulo()" value="avanti">
</td></tr></form>