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
Solved

Submit form from different frame

Posted on 2003-11-17
7
1,477 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
  • 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
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…

790 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