amacfarl
10-02-2003, 03:07 PM
Hi
I would like to write some code that validates the form and if any fields are not correct, the same page is displayed with additional text next to the fields that are not correct.
here is my code. I have tried with a simple test. I think it has something to do with the scope of the variable. I have you got any idea? Any help would be much appreciated
When the submit button is pressed:
<script language="JavaScript" type="text/JavaScript">
<!--
var sum;
function formSubmit()
{
sum = 1;
}
//-->
</script>
and further down the page I have the following code:
<script language="JavaScript" type="text/JavaScript">
<!--
if (sum = = 1)
document.writeln("Test");
//-->
</script>
I would like to write some code that validates the form and if any fields are not correct, the same page is displayed with additional text next to the fields that are not correct.
here is my code. I have tried with a simple test. I think it has something to do with the scope of the variable. I have you got any idea? Any help would be much appreciated
When the submit button is pressed:
<script language="JavaScript" type="text/JavaScript">
<!--
var sum;
function formSubmit()
{
sum = 1;
}
//-->
</script>
and further down the page I have the following code:
<script language="JavaScript" type="text/JavaScript">
<!--
if (sum = = 1)
document.writeln("Test");
//-->
</script>