Solved

Javascript to submit form of parent from within iframe

Posted on 2009-07-06
2
575 Views
Last Modified: 2013-11-19
Hi

I have an iframe within a page with the page containing form field holders to hold data from the iframe (which is collected on submit of the form).
The iframe contains a dropdown and multilist

What I am looking for now is a way to get the parent form to submit when an onchange happens for the multilist...

Any ideas??
0
Comment
Question by:Plowmister
[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
2 Comments
 
LVL 10

Expert Comment

by:bugada
ID: 24787640
According that the iframe can access the outer page only if the are from the same domain you can simply do that:

document.getElementById('yourmultilist_id').onchange = function(e) {
    self.parent.document.getElementById('your_parent_form_id).submit();
    return false;
}

Put this code in your onload event.

Otherwise you can create a function:

function updateParentForm(e) {
    self.parent.document.getElementById('your_parent_form_id).submit();
    return false;
}

and assign it to the onchange event of your multilist.
0
 

Accepted Solution

by:
Plowmister earned 0 total points
ID: 25480461
I have abandoned this approach...sticking with what I have ... thanks anyway
0

Featured Post

Technology Partners: 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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
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…

724 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