Salve,
ho scaricato il form cdosys da aruba, ma ho un problema con la validazione dei campi obbligatori, cioè se non inserisco nulla mi viene segnalato ma se inserisco spazi vuoti viene accettato.
C'è un modo per risolvere tale inconveniente?
Grazie.
Questa è l'intera pagina, in questo esempio i campi nome, cognome ed e-mail sono obbliagatori, però come dicevo se inserisco spazi vuoti vengono accettati.
<HTML>
<HEAD>
<TITLE>modulo contatto cdosys formato html</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style type="text/css">
A:link, A:visited { text-decoration: none }
A:hover { text-decoration: underline }
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' deve essere valida.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' campo obbligatorio.\n'; }
} if (errors) alert('Inserire email valida:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
</HEAD>
<BODY BGCOLOR=#FFFFFF text="#333333">
<div align="center">
<table width="715" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="63%" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="40%" align="center">
<tr>
<td width="100%">
<form action="formcdosys.asp" method="post" name="form1" onSubmit="MM_validateForm('Nome','','R','Cognome', '','R','email','','RisEmail');return document.MM_returnValue">
<table width="361" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="170"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#333333">Nome *</font></td>
<td width="191"><font color="#333333" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="nome" size="20">
</font></td>
</tr>
<tr>
<td width="170"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#333333">Cognome *</font></td>
<td width="191"><font color="#333333" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="cognome" size="20">
</font></td>
</tr>
<tr>
<td width="170"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#333333">Telefono</font></td>
<td width="191"><font color="#333333" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="tel" size="20">
</font></td>
</tr>
<tr>
<td width="170"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#333333">E-mail
*</font></td>
<td width="191"><font color="#333333" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="email" size="20">
</font></td>
</tr>
<tr>
<td width="170">
<font size="2" color="#333333" face="Verdana, Arial, Helvetica, sans-serif">
provenienza</font></td>
<td width="191"><font color="#333333" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="provenienza" size="20">
</font></td>
</tr>
<tr>
<td width="170"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#333333">Messaggio</font></td>
<td width="191">
<font size="1" color="#333333" face="Verdana, Arial, Helvetica, sans-serif">
<textarea name="messaggio" rows="5" cols="33" wrap="VIRTUAL"></textarea>
</font> </td>
</tr>
</table>
<p align="center">
<font size="1" color="#333333" face="Verdana, Arial, Helvetica, sans-serif">
<input type="submit" name="Submit" value="Contatto">
</font> </p>
</form>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">* richiesto
</font> </td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</BODY>
</HTML>