Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Frontpage Validation and JavaScript Validation Co Exist??

Status
Not open for further replies.
Jan 27, 2003
9
US
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>

 
Does this problem show up when you view the page in a web browser that's not controlled by Front Page? I copied and pasted your code into a text editor, saved it, then used both IE 6 and Firefox to view it, and it worked fine with the "Front Page validation". In actuality, that's nothing more than some notes to Front Page, and once you view the page in a browser, the commented code is ignored.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top