M
Myk Quayce
I have a small .aspx page that uses old style forms with client-side JavaScript validation. Everything works fine until I try to
upate the database with some new information. I must be doing something fundamentally wrong because I can't find any help on this
anywhere.
Here's my HTML form...
<form name="frmNewUser" onSubmit="return validateForm();">
<table>
<tr><td>User Name:</td><td><input id="iptUserName" type="text" size="20" /></td></tr>
<tr><td>E-mail Address:</td><td><input id="iptUserEmail" type="text" size="40" /></td></tr>
<tr><td colspan=2><input type="submit" value="Submit Details" /></td></tr>
</table>
</form>
Here's my client-side JavaScript validation...
function validateForm()
{
var userName = document.frmNewUser.iptUserName.value;
var userEmail = document.frmNewUser.iptUserEmail.value;
if(userName.length < 2 || userName.length > 15)
{
alert("The user name must be between 2 and 15 characters.");
return false;
}
if(userEmail.indexOf("@") == -1)
{
alert("You must enter a valid e-mail address.");
return false;
}
return true;
}
How do I get the values from the form in to my database?
upate the database with some new information. I must be doing something fundamentally wrong because I can't find any help on this
anywhere.
Here's my HTML form...
<form name="frmNewUser" onSubmit="return validateForm();">
<table>
<tr><td>User Name:</td><td><input id="iptUserName" type="text" size="20" /></td></tr>
<tr><td>E-mail Address:</td><td><input id="iptUserEmail" type="text" size="40" /></td></tr>
<tr><td colspan=2><input type="submit" value="Submit Details" /></td></tr>
</table>
</form>
Here's my client-side JavaScript validation...
function validateForm()
{
var userName = document.frmNewUser.iptUserName.value;
var userEmail = document.frmNewUser.iptUserEmail.value;
if(userName.length < 2 || userName.length > 15)
{
alert("The user name must be between 2 and 15 characters.");
return false;
}
if(userEmail.indexOf("@") == -1)
{
alert("You must enter a valid e-mail address.");
return false;
}
return true;
}
How do I get the values from the form in to my database?