473,499 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parent/iframe set iframe source and submit form

Ok, I've been at this two days now and have scoured the group for help
to no avail.

I have a main web page that contains a form and an iframe. I need to
submit the form and set the iframe source file in one action and have
it work with both IE and other browsers. So far, i have not had any
luck.

Form name "fmUpload", frame name, "progframe".

At one point i tried doing both in one function on the main page:
function startupload() {
document.fmUpload.action="http://newurl.com/form.html";
var iframe = document.getElementById("progframe");
iframe.src = "http://newurl.com/iframe.html";
}

Did not work in both IE and FF.

Then i tried doing the set iframe src on the form button click, then
the new iframe page submit the parent form using a body onLoad. That
did not work in IE with:

function subForm() {
parent.document.forms.fmUpload.submit();
}
</script>
<body onLoad=subForm()>

This really hurts. If anyone can help me with a simple explanation, i
would appreciate it. Code would be much appreciated!

Mar 9 '06 #1
2 17043
The thing that catches my eye here is where you say that you have "Form
name "fmUpload", frame name, "progframe"". If the <iframe> is written
as
<iframe name="progframe">...</iframe>
then in the JavaScript, the line,
var iframe = document.getElementById("progframe");
will not work. The proper HTML would have to be:
<iframe id="progframe">...</iframe>

document.forms["fmUpload"].action="http://newurl.com/form.html";
should work too and may be a bit more clear.

Other than that, the js function looks OK and should work in both IE
and FF

If this doesn't help, let me know.

Mar 9 '06 #2
Thanks for the reply. I managed to get it running in both IE and FF.
The order the code was executed in happend to make a difference for
some reason. Doing the frame location before th form submit changed teh
frame location without the action

here is my final code:
<SCRIPT Language="JavaScript">
function startupload() {
{
{
document.fmUpload.action="http://xxx.com/xxx>";
document.fmUpload.submit();
}
frames['progframe'].location.href = "http://yyy.com/yyy";
}
}
</script>
The form button triggers an onClick even calling the script.

hope that helps anyone else that may have had issues.

Mar 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
41171
by: HolaGoogle | last post by:
Hi, Sorrryy to ask such basic question but i do need your help! Here's what i'm trying to do: In my parent form i'm calling a my Iframe form to get certain value, then depending on that value...
2
2388
by: Targa | last post by:
Not sure if this is the correct group for this but I assume this can be done with javascript. Basically, I have a page with a form on it. There is also an IFRAME on the page that has several...
1
2652
by: user | last post by:
I have a parent aspx page with a few iframes. Each of the iframes show an aspx page with a datagrid whose rows all show editable entry fields at all times. The user can enter values into the parent...
4
19493
by: Jayyde | last post by:
Is there any way to capture a button click inside an iFrame and perform both an action on that page and one on the parent page? Basically I have a page atm that allows the user to add a record to...
1
5252
by: XP | last post by:
Hello Everyone, I was stuck with this really frustrating problem for sometime. Let me explain what I am trying to achieve: There is a form and an inner iframe. The form's target is set to the...
1
3047
by: Anderh | last post by:
hi all, I have using iframe for call php file called , I wnat submit this form inside iframe from parent form in main page but I codnt make it. <input type="button" id="s" name="s" value="submit...
3
5943
by: jagann2007 | last post by:
Hi all, I have a webpage with an IFRAME in it. But some of the pages on my IFRAME which has forms which are really long. So, I want a script or a html code whereby I can scroll to the top of...
1
4493
by: IframeLearner | last post by:
Hi , I am trying to upload a file from a parent.jsp using Iframes. From Parent page. I have to save Subject, Desc, File and file name. to upload the file i am using Iframe. I want the...
0
7009
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4602
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.