473,236 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 software developers and data experts.

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 17028
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
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
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
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
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
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
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
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
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...

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.