Solved

Javascript to submit form of parent from within iframe

Posted on 2009-07-06
2
572 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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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 (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

839 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