R
Rick
Hello,
I posted a question regarding data validation earlier and it worked
great! I have a new question. Is there anyway to cut through all the
if statements and just have a for loop that uses the id numbers
associated with each input. Here's the code I have so far:
<html>
<head>
<script type="text/javascript">
function main(form)
{
if (form.description.value =='')
{
alert("you have not entered in a description");
return false;
}
if (form.awarddate.value =='')
{
alert("you have not entered in an award date2");
return false;
}
if(form.awarddate2.value =='')
{
alert("you have not entered in an award date2");
return false;
return true;
}
</script>
</head>
<body>
<form action="submit.html" method="post" name="input" onsubmit="return
main(this)">
<table>
<tr>
<th>Rick's Test Page<br><br></th>
</tr>
<tr>
<td>Description:<td><input type=text name="description" id=1>
</tr><tr>
<td>Award Date:<td><input type=text name="awarddate" id=2>
</tr><tr>
<td>Award Date 2:<td><input type=text name="awarddate2" id=3>
</tr>
</table>
<input type="submit" value="Submit" class="FormText">
</form>
</body>
</html>
So In this case I'd want to make a for loop that loops from id=1 to
id=3. Is there anyway to do that? Thanks for the help!
Rick
I posted a question regarding data validation earlier and it worked
great! I have a new question. Is there anyway to cut through all the
if statements and just have a for loop that uses the id numbers
associated with each input. Here's the code I have so far:
<html>
<head>
<script type="text/javascript">
function main(form)
{
if (form.description.value =='')
{
alert("you have not entered in a description");
return false;
}
if (form.awarddate.value =='')
{
alert("you have not entered in an award date2");
return false;
}
if(form.awarddate2.value =='')
{
alert("you have not entered in an award date2");
return false;
return true;
}
</script>
</head>
<body>
<form action="submit.html" method="post" name="input" onsubmit="return
main(this)">
<table>
<tr>
<th>Rick's Test Page<br><br></th>
</tr>
<tr>
<td>Description:<td><input type=text name="description" id=1>
</tr><tr>
<td>Award Date:<td><input type=text name="awarddate" id=2>
</tr><tr>
<td>Award Date 2:<td><input type=text name="awarddate2" id=3>
</tr>
</table>
<input type="submit" value="Submit" class="FormText">
</form>
</body>
</html>
So In this case I'd want to make a for loop that loops from id=1 to
id=3. Is there anyway to do that? Thanks for the help!
Rick