• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 554
  • Last Modified:

javascript submit form and onsubmit event problem

Hello!
I have that kind of code:
<html>
<body>
<a href="#" onclick="javascript:document.tynd.submit();">TYNG</a>
<form name="tynd" method="GET" action="http://www.tv.ee/static/manager/pildid/console/evideo/test1.asp" target="judges" onsubmit="window.open('about:blank','judges','width=333,height=612,menubar=no,toobar=no,scrollbars=no,resizable=no')">
<input type="hidden" name="id" value="339">
<input type="hidden" name="type" value="kodu">
<input type="hidden" name="evideo" value="true">
<input type="hidden" name="data" value="lisatud">
<input type="hidden" name="popup" value="haha">
<input type="hidden" name="action" value="tere">
<input type="Submit" name="Submit">
</form>
</body>
</html>

When I click on the submit button then onsubmit is also included but when I click on the text link then onsubmit in not taken
How to solve this problem????
0
PSERK
Asked:
PSERK
  • 5
  • 2
1 Solution
 
knightEknightCommented:
<a href="#" onclick="document.tynd.Submit.click();return false;">TYNG</a>
0
 
knightEknightCommented:
be careful never to name your submit buttons "submit" as you will overwrite the form's submit() method.  In this case you named it "Submit" instead of "submit" so you are ok.
0
 
knightEknightCommented:
also, you should return true from the onsubmit if you want the form to submit (otherwise return false) ...

onsubmit="window.open('about:blank','judges','width=333,height=612,menubar=no,toobar=no,scrollbars=no,resizable=no')return true;">
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
knightEknightCommented:
... but note that from the onclick of the link, I return false instead of true.
0
 
knightEknightCommented:
another way:

onsubmit="window.open('',this.target,'width=333,height=612,menubar=no,toobar=no,scrollbars=no,resizable=no');return true;">

and oops ... I left out the ; between the end of the open function and return true in the previous post.
0
 
PSERKAuthor Commented:
But how to make this submit button hidden. I only want to show the text link.
0
 
PSERKAuthor Commented:
Oh I got it already
<div style="visibility:hidden">
<input type="Submit" name="Submit">
</div>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now