Solved

Javascript to submit form of parent from within iframe

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

809 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