Premetto che sono un principiante, quindi prendi con la dovuta cautela quello che dico.
Ad ogni modo, riguardo al controllo per il "secondo campo password" io ho questo codice che ho copiato qua e la.
codice:
<%@LANGUAGE = JScript%>
<html>
<body>
<table align="center" width="90%" cellpadding="1" cellspacing="0" border="1">
<script Language="JavaScript" Type="text/javascript"><!--
function FrontPage_Form1_Validator(theForm)
{
if (theForm.nome.value == "")
{
alert("Inserire un valore per il campo \"nome\".");
theForm.nome.focus();
return (false);
}
if (theForm.nome.value.length > 255)
{
alert("Inserire al massimo 255 caratteri nel campo \"nome\".");
theForm.nome.focus();
return (false);
}
if (theForm.password.value == "")
{
alert("Inserire un valore per il campo \"password\".");
theForm.password.focus();
return (false);
}
if (theForm.password.value.length < 3)
{
alert("Inserire almeno 3 caratteri nel campo \"password\".");
theForm.password.focus();
return (false);
}
if (theForm.password.value.length > 15)
{
alert("Inserire al massimo 15 caratteri nel campo \"password\".");
theForm.password.focus();
return (false);
}
if (theForm.password1.value != theForm.password.value)
{
alert("Password di conferma errata, ridigitare prego.");
theForm.password1.value = ("");
theForm.password1.focus();
return (false);
}
return (true);
}
//--></script><form method="POST" action="nuovo.asp?azione=ADD" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
<tr>
<td>Nome*<input type="text" name="nome" maxlength="255" style="width: 100%;" size="20"></td>
</tr>
<tr>
<td >Password* (min. 3 - max. 15 caratteri alfanumerici)<input type="password" name="password" maxlength="15" style="width: 100%;" size="20"></td>
</tr>
<tr>
<td >Conferma password*<input type="password" name="password1" maxlength="15" style="width: 100%;" size="20"></td>
</tr>
<tr>
<td align="right"><input type="submit" value="Registra"></td>
</tr>
</form>
</table>
</body>
</html>
Il mio form serve per inserire il nome, la password (ed altri dati che, per brevità, non ho riportato nel codice sopra) nel database; quindi il mio codice prosegue (vedi sopra [form method="POST" action="nuovo.asp?azione=ADD"])con l'apertura del db e l'inserimento dei dati nello stesso se "azione==ADD" viene valutata "true" e di questa valutazione se ne "incarica" ([onsubmit="return FrontPage_Form1_Validator(this)"] - vedi sopra.
Spero di esserti stato di aiuto.
Ciao.