Submitting a form to an iframe

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Submitting a form to an iframe

Post by evilmonkey »

Hello,

I have a page that has an iframe in it. I have a field on that page that the user can fill in, and if he does, the stuff in the iframe updates (like a shoutbox). The feild is on the parent page, but the shoutbox content is in the iframe. How can I solve my problem? If possible, I would like to do it with javascript, but if there's no way, javascript it is. I tried looking up some solutions on google, but couldn't understand what the people were talking about (I have 0 knowledge of JS).

Thanks for the help.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if memory serves, it should be like submitting to a different frame/window would be. Set the target attribute in the form element. If you're wanting to use XHTML validation, you'll need to use some Javascript trickery to add the target attribute after page load, but it's still the same.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Code: Select all

<iframe name="iframe" src="page.php"></iframe>

<form action="page.php" target="iframe" method="post">
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Ah, okay, this simplifies matters, thanks. :D
Post Reply