nhurst1369
MIS
I'm new to Javascript so I hope this isn't a dumb question. I trying to get Javascript validation and Frontpage validation to both work in the same form. I'm thinking that it doesn't work because the Frontpage validation is returning a value of "True" that is then bypassing the javascript validation. Is there a way I can change my javascript validation so it will work?
The following is an abbreviated example of my code which works:
<HTML>
<HEAD>
<title></title>
<script Language="JavaScript">
function formvalidator(theForm)
{
if (theForm.MModule1.selectedIndex!=0)
{
if (theForm.EmpEx1.value == "")
{
alert("Please enter an Employee Example for Meditech Module #1");
theForm.EmpEx1.focus();
return (false);
}}
return true;
}
</script>
</Head>
<body>
<form method="POST" action="NAEmail.asp" onSubmit="return formvalidator(this);">
<select size="1" name="MModule1">
<option></option>
<option>ABS</option>
</select>
<p>
<input name="EmpEx1" size="22" style="font-family: Arial; ">
</p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
</BODY>
</HTML>
But when I add a Frontpage validated drop down the validation no longer works:
<HTML>
<HEAD>
<title></title>
<script Language="JavaScript">
function formvalidator(theForm)
{
if (theForm.MModule1.selectedIndex!=0)
{
if (theForm.EmpEx1.value == "")
{
alert("Please enter an Employee Example for Meditech Module #1");
theForm.EmpEx1.focus();
return (false);
}}
return true;
}
</script>
</Head>
<body>
<form method="POST" action="NAEmail.asp" onSubmit="return formvalidator(this);">
<select size="1" name="MModule1">
<option></option>
<option>ABS</option>
</select>
<p>
<input name="EmpEx1" size="22" style="font-family: Arial; ">
</p>
<p>
<!--webbot bot="Validation" B-Value-Required="TRUE" -->
<select size="1" name="ASPdropDown">
<option>Select</option>
</select>
</p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
</BODY>
</HTML>
The following is an abbreviated example of my code which works:
<HTML>
<HEAD>
<title></title>
<script Language="JavaScript">
function formvalidator(theForm)
{
if (theForm.MModule1.selectedIndex!=0)
{
if (theForm.EmpEx1.value == "")
{
alert("Please enter an Employee Example for Meditech Module #1");
theForm.EmpEx1.focus();
return (false);
}}
return true;
}
</script>
</Head>
<body>
<form method="POST" action="NAEmail.asp" onSubmit="return formvalidator(this);">
<select size="1" name="MModule1">
<option></option>
<option>ABS</option>
</select>
<p>
<input name="EmpEx1" size="22" style="font-family: Arial; ">
</p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
</BODY>
</HTML>
But when I add a Frontpage validated drop down the validation no longer works:
<HTML>
<HEAD>
<title></title>
<script Language="JavaScript">
function formvalidator(theForm)
{
if (theForm.MModule1.selectedIndex!=0)
{
if (theForm.EmpEx1.value == "")
{
alert("Please enter an Employee Example for Meditech Module #1");
theForm.EmpEx1.focus();
return (false);
}}
return true;
}
</script>
</Head>
<body>
<form method="POST" action="NAEmail.asp" onSubmit="return formvalidator(this);">
<select size="1" name="MModule1">
<option></option>
<option>ABS</option>
</select>
<p>
<input name="EmpEx1" size="22" style="font-family: Arial; ">
</p>
<p>
<!--webbot bot="Validation" B-Value-Required="TRUE" -->
<select size="1" name="ASPdropDown">
<option>Select</option>
</select>
</p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
</BODY>
</HTML>