Solved

Submit form from different frame

Posted on 2003-11-17
7
1,478 Views
Last Modified: 2012-06-27
Each method I have used so far seems to ignore the onsubmit event handler on the form in frame1.

Any ideas?

frame1.htm:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" onsubmit="return verify(this);"

action="../screens/xmlCreate.jsp">
<textarea name="field1" cols="50" rows="4"></textarea>
</form>
</body>
</html>

frame2.htm

<html>
<head>
<title>Untitled Document</title>
</head>
<body>
  <a href="javascript:parent.mf_mainFrame.form1.submit();">Submit</a>
</body>
</html>
0
Comment
Question by:kate99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9764935
<a href="#" onclick="parent.mf_mainFrame.document.form1.submit();return false;">Submit</a>

or

<a href="#" onclick="parent.frames['frameName'].document.forms['form1'].submit();return false;">Submit</a>

0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9765168
Like this:

<a href="#" onClick="if(parent.mf_mainFrame.verify(parent.mf_mainFrame.form1) parent.mf_mainFrame.form1.submit;return false">Submit</a>



0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9765175
Sorry, take this:

<a href="#" onClick="if(parent.mf_mainFrame.verify(parent.mf_mainFrame.form1) parent.mf_mainFrame.form1.submit();return false">Submit</a>


0
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!

 

Author Comment

by:kate99
ID: 9769696
Thanks for your reply's.

In the end this worked:

<a href="#" onClick="if(parent.mf_mainFrame.verify(parent.mf_mainFrame.form1))parent.mf_mainFrame.form1.submit();">Submit</a>

What shall i do with the points? Netgroove's answer was nearest. Anyway let me know.

Cheers
0
 
LVL 10

Accepted Solution

by:
NetGroove earned 50 total points
ID: 9769947
What does mean nearest?
If you do not add ";return false"  that it is false but error tollerant.
Clicking on a <a> link will load the window with the link in the href.
The return value kills that default window load behaviour.

The naswer from jaysolomon  circumvents the validate()  function and submits only the form.

So does my proposal solve your problem.

By the way, there are more elegant ways doing what you want to do, but I prefered not to confuse you with details and keep the things like they are actually.



0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9771026
You should return false so that the link will not be followed.

>>nearest?

If your not satisfied, then tell us whats not right for you and we will try to suit your needs.

You have 2 options with the points

1 accept the answer that fullfills your requirements.

2 split the points between the experts that helped you.

Good Luck

jAy
0
 
LVL 10

Expert Comment

by:NetGroove
ID: 9782468
Thanks for the points.
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question