...

View Full Version : Forms.....arg!!!



sylvielaps
03-12-2006, 05:15 PM
Hey Guys:

I've been pulling my hair out with this stupid thing, I have to validate this stupid form as well as check to see if there is cookies and add them if they haven't. I know most of you probably are pros at this! So I am requesting some assistance. Please see the code attached, let me know what to do. As well I can't get something that will work with my radio buttons to validate as well as cookies. I'll be forever grateful to any helpers! Thank You in Advance!:confused: This is what I have so far!


<html>
<head>
<title>Registration</title>
<script language="Javascript">
function ValidateRegistration()
{
var first = document.Registration.fname;
var last = document.Registration.lname;
var addy = document.Registration.address;
var tele = document.Registration.telephone;
var mail = document.Registration.email;
var cc = document.Registration.card;
var what = document.Registration.age;
if (first.value == "")
{
window.alert("Please enter your first name!);
first.focus();
return false;
}
if (last.value == " ")
{
window.alert("Please enter your last name!);
last.focus();
return false;
}
if (addy.value == "")
{
window.alert("Please enter your address");
addy.focus();
return false;
}
if (tele.value == "")
{
window.alert("Please enter your telephone");
tele.focus();
return false;
}
if (mail.value == "")
{
window.alert("Please enter your e-mail!");
email.focus();
return false;
}
if (mail.value.indexOf("@", 0) < 0)
{
window.alert("Please enter a valid e-mail address");
email.focus();
return false;
}
if (mail.value.indexOf(".", 0) < 0)
{
window.alert("Please enter a valid e-mail address!");
email.focus();
return false;
}
if (what.selectedIndex < 1)
{
alert("Please select your age range!");
what.focus();
return false;
}
return true;
}

</script>
</head>
<body>
<font size="4" face="ARIAL, HELVETICA" color="blue">
<b>Please enter the following data</b></font><br/>
<form name="Registration" action="processRegistration.asp" method="POST" onSubmit="return ValidateRegistration();">
<p><font size="4" face="arial, helvetica">
<table>
<tr>
<td>First name:</td>
<td><input type="text" name="fname" size="20"></td>
</tr>
<tr>
<td>Last name:</td>
<td><input type="text" name="lname" size="20"></td>
</tr>
<tr>
<td>Address:</td>
<td><input type="text" name="address" size="20"></td>
</tr>
<tr>
<td>Telephone Number:</td>
<td><input type="text" name="telephone" size="20"></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email" size="20"></td>
</tr>
<tr>
<td>Please input your Credit Card Type: </td>
<tr>
<td><input type="radio" name="card" id="r1" value="mastercard"> MasterCard</td></tr>
<tr><td><input type="radio" name="card" id="r2" value="visa"> VISA</td></tr>
<tr><td><input type="radio" name="card" id="r3" value="amex"> American Express</td></tr>
<tr><td><input type="radio" name="card" id="r4" value="other"> Other</td></tr>
<tr>
<td>Choose your age range:</td></tr>
<td>
<select name="age">
<option value="10-20">10-20
</option>
<option value="21-30">21-30
</option>
<option value="31-40">31-40
</option>
<option value="41-50">41-50
</td>
</option>
</select><br/>
<table>
<tr><td><input type="submit" value="OK" name="submit">
<input type="Reset" value="Cancel" name="reset"></td></tr>
</font>
</p><font size="4" face="arial, helvetica"></font>
</form>
</body>
</html>

Brandoe85
03-13-2006, 05:16 AM
Please don't cross post.

http://www.codingforums.com/showthread.php?t=81824



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum