R
Rick
Hello,
I'm having trouble with submitting my form when checking to see if data
is present in the user-inputted fields. What I want to happen is for
the user to input various pieces of data, submit the form, and then
have a javascript function that checks to see if data is entered, and
if not, have an alert window tell the user which field to enter data
into and then revert back to that same page. If all data is entered,
it would submit the form and send the user to another page. However,
I'm having trouble with reverting back to the orginal page for the user
to update fields to. Here is my code for all other working parts:
<html>
<head>
<script type="text/javascript">
function main(form)
{
if(form.description.value =='')
{
alert("you have not entered in a description");
}
if(form.awarddate.value =='')
{
alert("you have not entered in an award date");
}
}
</SCRIPT>
</head>
<body>
<form name="input" action="submit.html" method="post">
<table>
Rick's Test Page</th><br><br>
<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>
</table>
<input type="submit" class="FormText" value="submit"
onClick="main(input)">
</form>
</body>
</html>
Any ideas?...Thanks!
Rick
I'm having trouble with submitting my form when checking to see if data
is present in the user-inputted fields. What I want to happen is for
the user to input various pieces of data, submit the form, and then
have a javascript function that checks to see if data is entered, and
if not, have an alert window tell the user which field to enter data
into and then revert back to that same page. If all data is entered,
it would submit the form and send the user to another page. However,
I'm having trouble with reverting back to the orginal page for the user
to update fields to. Here is my code for all other working parts:
<html>
<head>
<script type="text/javascript">
function main(form)
{
if(form.description.value =='')
{
alert("you have not entered in a description");
}
if(form.awarddate.value =='')
{
alert("you have not entered in an award date");
}
}
</SCRIPT>
</head>
<body>
<form name="input" action="submit.html" method="post">
<table>
Rick's Test Page</th><br><br>
<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>
</table>
<input type="submit" class="FormText" value="submit"
onClick="main(input)">
</form>
</body>
</html>
Any ideas?...Thanks!
Rick