Solved

Javascript to submit form of parent from within iframe

Posted on 2009-07-06
2
562 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
Comment Utility
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
Comment Utility
I have abandoned this approach...sticking with what I have ... thanks anyway
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now