Validation of more than 9 fields

wxdqz

New Member
Well, seems like i have a problem. I cannt validate all of my text fields because of the limit to the number of text fields that are present. Can anyone help out? Basically this is an imput form and all the fields need to be filled out before the data is sent off to an ASP page (Which adds these to a database).

Thanks for any help :)

Twigathy

CODE BURST FOLLOWS:

<html>
<head>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function verify() {
var themessage = "You are required to complete the following fields:";
if (document.form.name.value=="") {
themessage = themessage + " - First Name";
}
if (document.form.comments.value=="") {
themessage = themessage + " - Last Name";
}
if (document.form.Depth.value=="") {
themessage = themessage + " - Depth";
}
if (document.form.Height.value=="") {
themessage = themessage + " - Height";
}
if (document.form.Width.value=="") {
themessage = themessage + " - Width";
}
if (document.form.Weight.value=="") {
themessage = themessage + " - Weight";
}
if (document.form.Compatibility.value=="") {
themessage = themessage + " - Compatibility";
}
if (document.form.Manufacterer.value=="") {
themessage = themessage + " - Manufacuror";
}
if (document.form.Cache.value=="") {
themessage = themessage + " - Cache";
}

//alert if fields are empty and cancel form submit
if (themessage == "You are required to complete the following fields: ") {
document.form.submit();
}
else {
alert(themessage);
return false;
}
}
// End -->
</script>






<title>Guestbook Form</title>
</head>
<body bgcolor="white" text="black">
<!-- Begin form code -->
<form name="form" method="post" action="add_to_guestbook.asp" onclick="verify();">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1">
<tr>
<td>Field name</td>
<td> Enter your data here</td>
<td>Comments about the field</td>
<td>Example data</td>
</tr>
<tr>
<td>Submitters Name:</td>
<td> <input type="text" name="name" maxlength="20" size="20"></td>
<td>Your Name</td>
<td>Joe Bloggs</td>
</tr>
<tr>
<td>Comments:</td>
<td> <input type="text" name="comments" maxlength="60" size="20"></td>
<td>Any comments you have about this particular data entry</td>
<td>Faulty drive, misreporting formatted size</td>
</tr>
<tr>
<td>Depth:</td>
<td> <input type="text" name="Depth" maxlength="3" size="20"></td>
<td>Depth of the drive in mm's</td>
<td>300</td>
</tr>
<tr>
<td>Height:</td>
<td> <input type="text" name="Height" maxlength="3" size="20"></td>
<td>Height of the drive in mm's</td>
<td>30</td>
</tr>
<tr>
<td>Width:</td>
<td> <input type="text" name="Width" maxlength="3" size="20"></td>
<td>Width of the drive in mm's</td>
<td>50</td>
</tr>
<tr>
<td>Weight:</td>
<td> <input type="text" name="Weight" maxlength="3" size="20"></td>
<td>Weight (Mass :P) of the drive in g's</td>
<td>250</td>
</tr>
<tr>
<td>Compatibility:</td>
<td> <input type="text" name="Compatibility" maxlength="8" size="20"></td>
<td>Comaptibility of the drive</td>
<td>All, PC, Mac</td>
</tr>
<tr>
<td>Manufacterer: </td>
<td> <input type="text" name="Manufacterer" maxlength="20" size="20"></td>
<td>Manufactoror</td>
<td>Western Digital</td>
</tr>
<tr>
<td>Cache:</td>
<td> <input type="text" name="Cache" maxlength="4" size="20"></td>
<td>Cache of the drive, KB's</td>
<td>1024</td>
</tr>
<tr>
<td>Transfer Rate: </td>
<td> <input type="text" name="Transfer Rate" maxlength="3" size="20"></td>
<td>Transfer rate measured in megabytes per second</td>
<td>100</td>
</tr>
<tr>
<td>Enclosure Type:</td>
<td> <input type="text" name="Enclosure Type" maxlength="3" size="20"></td>
<td>Enclosure type</td>
<td>ATX</td>
</tr>
<tr>
<td>Form Factor:</td>
<td> <input type="text" name="Form Factor" maxlength="20" size="20"></td>
<td>Almost always the same as Enclosure Type</td>
<td>ATX</td>
</tr>
<tr>
<td>Capacity:</td>
<td> <input type="text" name="Capacity" maxlength="3" size="20"></td>
<td>Formatted capacity. Assume NTFS file system. Measured in Gigabytes</td>
<td>80</td>
</tr>
<tr>
<td>Spindle Speed:</td>
<td> <input type="text" name="Spindle Speed" maxlength="5" size="20"></td>
<td>Speed of the drives' spindle in RPM</td>
<td>7200</td>
</tr>
<tr>
<td>Price: </td>
<td> <input type="text" name="Price" maxlength="7" size="20"></td>
<td>Price of the drive. Assume UK ?lt;/td>
<td>80</td>
</tr>
<tr>
<td>Average Seek Time: </td>
<td> <input type="text" name="Average Seek Time" maxlength="3" size="20"></td>
<td>Average amount of time it takes to seek to another file. Measured in milaseconds</td>
<td>15</td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value=http://www.webdeveloper.com/forum/archive/index.php/"Submit"></td>
<td>&nbsp;</td>
</tr>
</table>
;</form>
<!-- End form code -->
</body>
</html>
 
Back
Top