Oct 5th, 2000, 04:17 AM
Hi!
I have this form on my page, with an "onsubmit" function". Now I don't use a submit button to have the form submitted, but an image. So the code goes something like this (the file validationfunctions.js contains a function called validatecontents() ):
<script language="javascript">
<!--
function submittheform()
{
document.myform.submit();
}
//-->
</script>
<script language="javascript" src="validationfunctions.js">
</script>
.
.
<form name = "myform" action="nextpage.asp" onsubmit="validatecontents()">
.
.
<a href="javascript:submittheform()"><img src="image.jpg"></a>
</form>
Now when I click the image, it submits the form, without running the validatecontents-function first. Why? And how can I make it so it DOES run that function first?
Many thanx! :)
I have this form on my page, with an "onsubmit" function". Now I don't use a submit button to have the form submitted, but an image. So the code goes something like this (the file validationfunctions.js contains a function called validatecontents() ):
<script language="javascript">
<!--
function submittheform()
{
document.myform.submit();
}
//-->
</script>
<script language="javascript" src="validationfunctions.js">
</script>
.
.
<form name = "myform" action="nextpage.asp" onsubmit="validatecontents()">
.
.
<a href="javascript:submittheform()"><img src="image.jpg"></a>
</form>
Now when I click the image, it submits the form, without running the validatecontents-function first. Why? And how can I make it so it DOES run that function first?
Many thanx! :)