codice:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Code Example by DYNAMIC+</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<script type="text/javascript">
<!--
function checkData( __objForm )
{
var _errDescription = "";
var _errLastInvalid = null;
if ( !__objForm.elements['Title'].value.length )
{
_errLastInvalid = __objForm.elements['Title'];
_errDescription += " - il titolo è mancante\n";
}
if ( !__objForm.elements['Message'].value.length )
{
_errLastInvalid = __objForm.elements['Message'];
_errDescription += " - il messaggio è vuoto\n";
}
if ( !__objForm.elements['Categoria'][0].checked &&
!__objForm.elements['Categoria'][1].checked &&
!__objForm.elements['Categoria'][2].checked )
{
_errLastInvalid = __objForm.elements['Categoria'][0];
_errDescription += " - nessuna categoria selezionata\n";
}
if ( _errLastInvalid == null )
return true;
else {
alert( "Si sono verificati i seguenti errori:\n" + _errDescription + "\n" +
"Correggerli e riprovare l'invio del form!" );
_errLastInvalid.focus( );
return false;
}
}
//-->
</script>
</head>
<body>
<div>
<form method="post" enctype="multipart/form-data"" action="oknuova.asp?Det=<%=Det%>" onsubmit="return checkData( this );">
<input type="text" name="Title" size="40" />
<table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr bgcolor="#BBBBFF">
<td><input type="radio" name="Categoria" value="2" /></td>
<td>Information on-line</td>
</tr>
<tr bgcolor="#BBBBFF">
<td><input type="radio" name="Categoria" value="3" /></td>
<td>Lettere aggiornamenti</td>
</tr>
<tr bgcolor="#BBBBFF">
<td><input type="radio" name="Categoria" value="4" /></td>
<td>Note</td>
</tr>
</table>
<textarea name="Message" rows="6" cols="70"></textarea>
<input type="submit" value=" Aggiungi " name="SUBMIT2">
</form>
</div>
</body>
</html>