B
Betty
I have two fields (username & department) that i need the user to
update so i require a little bit of JavaScript to validate to code:
Here is what i have in my HEAD tag...
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function ValidateForm(form)
{
if (IsEmpty(form.username))
{
alert("Please enter your user name.")
form.username.focus();
return false;
}
if (IsEmpty(form.department))
{
alert("Please enter the department you work for.")
form.department.focus();
return false;
}
else return true;
}
</script>
</HEAD>
and here is what i have in my body tag...
<BODY>
<form name="submitform" action="--WEBBOT-SELF--" method="POST"
onSubmit="return ValidateForm(this)" >
<!--webbot bot="SaveResults" U-File="../_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" startspan --><input
TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults"
i-checksum="43374" endspan -->
Please enter your User Name and your Department.<br><br>
<table border=0>
<tr>
<td align=center>User Name</td>
<td> </td>
<td align=center>Department</td>
</tr>
<tr>
<td align=center><input type=text name=name size=10></td>
<td></td>
<td align=center><input type=text name=dept size=10></td>
</tr>
<tr>
<td colspan=3 align=center><input type=submit value="Submit!"></td>
</tr>
</table>
</form>
</BODY>
When i add a user name and click the submit button i get a Confirmation
page???
What i really want is a pop up box to appear if the fields are blank
when the user clicks the submit button, this should advise the user
that the blank fields need to be filled out.
Can anyone help?
Regards
Betty
update so i require a little bit of JavaScript to validate to code:
Here is what i have in my HEAD tag...
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function ValidateForm(form)
{
if (IsEmpty(form.username))
{
alert("Please enter your user name.")
form.username.focus();
return false;
}
if (IsEmpty(form.department))
{
alert("Please enter the department you work for.")
form.department.focus();
return false;
}
else return true;
}
</script>
</HEAD>
and here is what i have in my body tag...
<BODY>
<form name="submitform" action="--WEBBOT-SELF--" method="POST"
onSubmit="return ValidateForm(this)" >
<!--webbot bot="SaveResults" U-File="../_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" startspan --><input
TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults"
i-checksum="43374" endspan -->
Please enter your User Name and your Department.<br><br>
<table border=0>
<tr>
<td align=center>User Name</td>
<td> </td>
<td align=center>Department</td>
</tr>
<tr>
<td align=center><input type=text name=name size=10></td>
<td></td>
<td align=center><input type=text name=dept size=10></td>
</tr>
<tr>
<td colspan=3 align=center><input type=submit value="Submit!"></td>
</tr>
</table>
</form>
</BODY>
When i add a user name and click the submit button i get a Confirmation
page???
What i really want is a pop up box to appear if the fields are blank
when the user clicks the submit button, this should advise the user
that the blank fields need to be filled out.
Can anyone help?
Regards
Betty