Link to home
Start Free TrialLog in
Avatar of bendecko
bendecko

asked on

Submit Iframe contents from button on parent document

Hi

Have two pages a parent page and a sub (iframe) page.

The subpage contains a long length of user check'ed check boxes.

The parent page contains the submit button.

How to I get the data on Iframe?  It ideally needs to work with GET as well as POST.  

Thanks

Bendecko
Avatar of Batalf
Batalf
Flag of United States of America image

You could change the submit button in the parent frame to a button

<input type="button">

and then make it submit the form in the iframe.

<input type="button" onclick="document.getElementById('iframeID').document.formName.submit()" value="Submit">

"iframeID" is the id of your iframe

<iframe id="iframeID"....

and "formName" is the name of your form in the iframe

<form name="formName"...
Avatar of webwoman
webwoman

Why is it constructed this way?

If the iframe is from a different domain, you WILL NOT be able to get the info on the form. If it's on YOUR domain, that begs the question of why an iframe? Why not an include?
ASKER CERTIFIED SOLUTION
Avatar of Batalf
Batalf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bendecko

ASKER

Thanks,

I've got to go with the quick and easy solution.  Well spotted,  it was the scrolling functionailty that was required and hence the use of the frame.

Thanks to all for comments.

Bendecko