iframe and parent window submit

I have a page with an iframe in it, the page contains some textfields and then the iframe.
the iframe has a button for submit. now the user first types the values in textfields then selects items in the iframe and then clicks submit and the page refreshes and the values in textfields is lost
i printed $_POST value, but it just shows the fields in the iframe not the fields in the parent page
the iframe target is set to _top.

hope i am clear with my situation.

thanks.
Desire2changeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
Hello Desire2change,

There's no relation between an iframe and its parent container. You are only allowed to change iframe attributes like size and url but not the content.
The iframe _top are not the parent container.

Regards.
0
Desire2changeAuthor Commented:
i just want that when the iframe form is submitted the parent form should also be submitted
0
leakim971PluritechnicianCommented:
I understand your need but when you can't, you can't...

If you're ready to use the onload event of the iframe to detect the second time it load (the first time it load with the parent), you can use it to submit the parent form too.

Check this example :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript">
	var not_the_first_time = 0;
</script>
</head>
<body>
<iframe onload="if( not_the_first_time++ > 0 ) alert('I m loading');"  width="640" height="400" src="http://www.google.com" />
</body>
</html>

Open in new window

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

leakim971PluritechnicianCommented:
So to submit the parent form :

(you search something on google and when submit the form to get the result you submit the parent too, so we go on EE)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript">
	var not_the_first_time = 0;
</script>
</head>
<body>
<form action="http://www.experts-exchange.com" method="GET" >
	<iframe onload="if( not_the_first_time++ > 0 ) document.forms[0].submit();"  width="640" height="400" src="http://www.google.com"  />
</form>
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Desire2changeAuthor Commented:
helped me partially
0
leakim971PluritechnicianCommented:
Thanks for the points!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.