473,225 Members | 787 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,225 software developers and data experts.

Problem with form variables in frames

Hi,

I am using frames (I know that its not a good practice, but I have to).
Each of these frames have separate form variables, all of which are
needed in the parent frame.

Now, the problem is that only one frame in the parent frame has a
submit button. Is there any way in which I can submit the forms of
other frames on click of the submit of this particular frame? I mean,
is there any way in which I can access the forms in JSPs of other
frames?

Thanks.

Sep 26 '06 #1
3 1368
wrote on 26 sep 2006 in comp.lang.javascript:
I am using frames (I know that its not a good practice, but I have to).
Each of these frames have separate form variables, all of which are
needed in the parent frame.

Now, the problem is that only one frame in the parent frame has a
submit button. Is there any way in which I can submit the forms of
other frames on click of the submit of this particular frame? I mean,
is there any way in which I can access the forms in JSPs of other
frames?
What are JSPs?

You could access the other frames form values [not 'variables']
with with javascript [if they are in the same domain.]

Not tested, but try something like this:

<form onsubmit='return doit(this)'>
<input name='hidden1' type='hidden'>
</form>

.....
function doit(thisFrame){
if (!window.parent) return false;
var theOtherFrame =
window.parent.otherFrame.document;
var theOtherElement =
theOtherFrame.forms['otherForm'].elements['otherElement'];
thisFrame.elements['hidden1'].value = theOtherElement.value;
return true
}

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 26 '06 #2

mi***********@gmail.com wrote:
Hi,

I am using frames (I know that its not a good practice, but I have to).
Each of these frames have separate form variables, all of which are
needed in the parent frame.

Now, the problem is that only one frame in the parent frame has a
submit button. Is there any way in which I can submit the forms of
other frames on click of the submit of this particular frame? I mean,
is there any way in which I can access the forms in JSPs of other
frames?

Thanks.
Sure. Simple example looks like:

<frameset cols="50%,50%">
<frame name="frame1" src="frame1.html"/>
<frameset rows="50%,50%">
<frame name="frame2" src="frame2.html"/>
<frame name="frame3" src="frame3.html"/>
</frameset>
</frameset>

Frame1 and Frame2 look like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
<form name="form1" action="http://www.google.com/">
</form>
</body>
</html>

Frame3 has the same form but with a submit button and the javascript
needed to submit all three forms at once:

<html>
<head>
<script type="text/javascript">
function updateAll() {
if (window.parent) {
window.parent.frame1.document.forms['form1'].submit();
window.parent.frame2.document.forms['form1'].submit();
document.forms['form1'].submit();
return true;
}
else {
return false;
}
}
</script>
</head>
<body>
<form name="form1" action="http://www.google.com/" onsubmit="return
updateAll();">
<input type="submit" value="Update"/>
</form>
</body>
</html>

HTH

Sep 26 '06 #3

Evertjan. wrote:
wrote on 26 sep 2006 in comp.lang.javascript:
I am using frames (I know that its not a good practice, but I have to).
Each of these frames have separate form variables, all of which are
needed in the parent frame.

Now, the problem is that only one frame in the parent frame has a
submit button. Is there any way in which I can submit the forms of
other frames on click of the submit of this particular frame? I mean,
is there any way in which I can access the forms in JSPs of other
frames?

What are JSPs?
JavaServer Pages. Server side java that results in rendered HTML
(somewhat like ASPs are to VBScript or J++).
>
You could access the other frames form values [not 'variables']
with with javascript [if they are in the same domain.]

Not tested, but try something like this:

<form onsubmit='return doit(this)'>
<input name='hidden1' type='hidden'>
</form>

....
function doit(thisFrame){
if (!window.parent) return false;
var theOtherFrame =
window.parent.otherFrame.document;
var theOtherElement =
theOtherFrame.forms['otherForm'].elements['otherElement'];
thisFrame.elements['hidden1'].value = theOtherElement.value;
return true
}

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 26 '06 #4

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

Similar topics

1
by: Rahul Chatterjee | last post by:
Hello all I have a web page which has 3 frames. The top and the left navigation frames are on a separate domain. The right display frame initially starts on the same domain as the other two...
1
by: Ed Blinn | last post by:
Can someone tell me why this script will only work on a Mac with Internet Explorer. Thanks, Ed <html> <head> <script type="text/javascript"> //Square Root
1
by: Paul | last post by:
The problem I am having involves the sequence of events between frames in an html page. The Pages: Page A has an imbedded IFrame which displays Page B. Page A has a radio button which on...
2
by: sjanie | last post by:
The error code is: Microsoft JScript compilation error '800a03ec' Expected ';' /bicc.nl/Connections/BICCwebsite.asp, line 2 Set Conn = Server.CreateObject("ADODB.Connection") ----^
0
by: John Wood | last post by:
I have an ASP script in which I want to control the screen as two frames If I use a FRAMESET this works fine but the frame geometry is fixed the script uses POST and hidden fields to transfer the...
1
by: Bill H | last post by:
I run a dbms application that interfaces with the web. This module creates a frames page with two frames ('main' and 'mwinfoframe'). All communication with the dbms is routed through the...
2
by: Wee Bubba | last post by:
my page is split into 2 frames. my upper frame contains a data entry form consisting of asp.net textbox server controls. my lower frame displays rows of data. when a user clicks the submit...
4
by: Harry | last post by:
Good Day, I am writing a code for the H.264 Video codec.I am using VC++ compiler,but programming is in c only.I have grouped the related global variables under one structure in a header file...
1
by: gzannd | last post by:
I have a problem with submitting a form to a PHP page through a dynamically created IFRAME in IE7. This code works fine in Firefox. However, IE7 submits an empty form--the correct PHP page is...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
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: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
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...

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.