|
-
Oct 5th, 2000, 04:17 AM
#1
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!
-
Oct 5th, 2000, 07:13 AM
#2
Hyperactive Member
try this
<form name = "myform" action="nextpage.asp" OnSubmit="return validatecontents()">
Also return true from the function validatecontents()
-
Oct 5th, 2000, 08:52 AM
#3
Hi!
I'm sorry, in my page the form declaration is like the solution you gave, but when submitting the problem here, I just typed the code in from heart, and forgot to type the return statement. 
So... the problem remains unsolved..
-
Oct 5th, 2000, 10:08 AM
#4
Frenzied Member
Why not call the validation function from your submittheform() function?
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|