codice:
<html>
<head>
<script type="text/javascript">
function controlloFormale(f){
if(!f.data.value.match(/^\d{2}\/\d{2}\/\d{4}$/)){
alert('il campo "data" non è nel formato corretto (gg/mm/aaaa)')
return false
}
if(!f.ora.value.match(/^\d{2}:\d{2}$/)){
alert('il campo "ora" non è nel formato corretto (hh:mm)')
return false
}
return true
}
</script>
</head>
<body>
<form onsubmit="return controlloFormale(this)">
data: <input type="text" name="data" />
ora: <input type="text" name="ora" />
<input type="submit" />
</form>
</body>
</html>
ciao