Skip to main content

Working with forms inside iframes

I was requested to do some work with forms using the iframes on a web page and it was needed to do a lot of Googling and thought to share those things.

1. Display a form on the main page and when the form is submitted the results should be shown on an iframe on the same page.
a. This task was pretty simple and what I had to do is give the same page as the action page of the form.
b. If the form data is defined on the page I had to show the iframe.When showing the iframe I had to give all the form data as query parameters on the URL of the iframe.

c. Then the resulting page was displayed correctly inside the iframe.
2. Then the resulting page which was inside the iframe was also a web form and it has to be submitted on the event of a button click which was on the main page.
a. For the button click event we have to fire a JavaScript function.

b. On that JavaScript function we can do the submission as follows.
c. This will be doing the submission and we have to redirect the resulting page to the same one.
3. When showing the resulting page inside the iframe we have to update the resulting values according to the values on the main page.
a. For that we have to submit the form again when we are showing the resulting page.
b. So we have to send a query parameter and if the query parameter is true then we have to do the main page form submission.

4. If we need o call a JavaScript function on main page on an event of something whch was palced inside the iframe we can call like,
onclick = “return parent.functionName(parameter)”
Hope this may help you when working with iframes and if there are better ways to do this or if something goes wrong (nobody is perfect) please do share it with me.


  1. The parent will not work with the pop-up windows.

    Which means you can not access parent window as parent so we have to use window.opener to get the parent window of a pop-up.


Post a Comment

Popular posts from this blog

Google API v3 with PHP using Blogger service

It was really hard for me to understand how the Google APIs are working at the first point and took few days for me to figure out. But after a successful working prototype it seems very easy. And also when I am searching for a simple example I was unable to find a good one that I can understand.

So let me list down step by step what I have done with URLs and as simple as I can.

Create a Google applocation - on the "Blogger API v3"Get the latest APIs client library for PHPlocation - the files to your host location on on localhostExtract the files to folder  named "GoogleClientApi"Create your php file outside of the folder Copy paste following code into the file and do the changes as needed  By changing the scope and the service object you can access all the services that is given by Google APIs through the PHP API library set given.
If there is anything …

How to get indexed by Google & Yahoo

I have seen a lot of ads and services online that provide the facility to get higher page ranks on search engines. But when I asked about those services on Google their respond was not much positive because they said it can decrease you page rank (because those services cannot be trusted always). It is happening because the page rank is depending on page visitors (as Google say). So the better way is to let the Google to index your site by sending them the address of your website. : here you can improve the traffic with the webmaster tools and you can send your website contents also. It is a legal, simple and direct hit.
You can send your web site address (even the blog) to Yahoo: also. It helps them to index your pages on their search engines.

It is better to come up with the content and services which are really useful for the visitors and the traffic will be increased regularly. I have gone through a lot of expe…

How to Install ColdFusion 8 on Linux?

It was real pain for me to install ColdFusion on my Linux box with Apache. Anyway we have installed it and I thought to share it because this may help you also to install ColdFusion on a Linux box.
First of all open a shell and then continue on this.

Grant Execute permission to the Coldfusion‐8‐lin.bin binary file
chmod +x Coldfusion‐8‐lin.bin

Execute Coldfusion‐8‐lin.bin

Enter the Locale
1 (English)

Hit Enter 28 times to continue the agreement

Enter "Y" to accept the agreement

Enter the version to install
3 (Developer Edition)

Enter the next task to perform
1 (Server Configuration)

Enter whether you have an existing server configuration
2 (No existing server configuration)

Enter the next task to perform
5 (continue installation)

Enter the installation path
Hit enter to accept the default path

Hit Enter 30 times to continue the agreement

Enter "Y" to accept the agreement

Enter the serial number
Hit Enter for no serial number

Enter whether you h…