[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 452
  • Last Modified:

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
0
bendecko
Asked:
bendecko
  • 2
1 Solution
 
BatalfCommented:
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"...
0
 
webwomanCommented:
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?
0
 
BatalfCommented:
If the reason for using iframe is that you need the ability to scroll, then maybe you could use a div with overflow:auto:

<div style="width:500px;height:500px;overflow:auto">
<!-- Your iframe content here-->
</div>
0
 
bendeckoAuthor Commented:
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
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now