Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I submit an html form inside an iframe without changing the outer page?

I'm editing some existing html where the javascript loads a another page inside an iframe. In the page is an html form. When I hit submit, I'd like for the outer page to stay and the iframe to change to the results page. However, right now the whole page changes to the results page for the form. I'm guessing there's a way to solve this javascript. Any suggestions?

like image 912
Eugene M Avatar asked May 08 '09 21:05

Eugene M


People also ask

Can you put a form in an iframe?

To embed your form using an iFrame, copy and paste the iFrame code directly into the HTML of your web page.

Can you iframe a specific part of page?

If you want to display specific area of external website using iframe, then you will learn in this article how to embed a specific part of a web page using css. Suppose, you want to show only one div element from another website and want to hide some specific content, then you can easily do this using <iframe> tag.

Can I override iframe CSS?

An iframe has another scope, so you can't access it to style or to change its content with javascript. It's basically "another page". The only thing you can do is to edit its own CSS, because with your global CSS you can't do anything.

How do I embed a form without an iframe?

You will need Formfacade, an add-on for Google Forms, to achieve that. Similar to the Embed HTML option, Formfacade will give you an embed code, which will allow you to render your form without iframe and without Google Form branding.


2 Answers

Target the form to the iframe:

<iframe name="foo"></iframe>

<form target="foo"></form>
like image 180
Greg Avatar answered Oct 16 '22 10:10

Greg


Try using the target attribute of the form tag. You can specify the frame.

like image 20
GiDo Avatar answered Oct 16 '22 11:10

GiDo