In phpxperts yahoo group there was a thread about how to submit a form in a iframe outside the iframe I mean from parent window. I replied my idea using js but the iframe should be in same domain. The js code is like
let me give u whole code. make a new file named frame.html and write the bellow code in that file
<form id="myformid" name="myformname" method="post" action="" target="_self" onSubmit="">
Name: <input type="text" size="20" name="name" value="" id="namefield" />
and open a new file again and save in same dir with name index.html and write the bellow code in it
< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Iframe form submit from outside</title>
<iframe src ="frame.html" width="auto" height="40px" frameborder="0" id="myframeid" name="myframename">
<p><input onClick="submitiframeform(); return false;" type="button" name="submit" value="Submit" /></p>
now open the index.html in browser and click the submit button and see the form is getting submitted. I think If you just check the code then I don’t need to explain ‘what is why’.
what if form in iframe hosted under another domain?
that surely help, Thanks!!
Awesome explanation. that’s very much helpful
I had a problem doing something above this.
I had a text box inside the iframe which needs to be populated with the value of parent textbox(in the main window)
can you able to post a solution. that will be great.
Thanks in advance