Using form data from one frame in another frame

K

Kathryn

I hope you can help as this is driving me crazy!

I have an asp which has 3 frames on it as follows:

<FRAMESET rows="50%,*,10%">
<FRAME src="rundetailstop.asp" name="rundetailstop" scrolling="no">
<FRAME src="rundetails.asp" name="rundetails" scrolling="auto">
<FRAME src="rundetailsbottom.asp" name="rundetailsbottom"
scrolling="no">
</FRAMESET>

The top frame(rundetailstop) is the heading, the middle
frame(rundetails) has the data within a form and the bottom
frame(rundetailsbottom) has some buttons on it within a form.

When a button is clicked in the bottom frame it submits the form and
goes off to a different ASP to do some processing. The problem is that
I need to take one piece of data from the middle form with me. The
middle frame has a textfield which contains a number I need to take
with me.

I'm assuming in the ASP I go off to when the button is clicked I can
only get the data from the form the request has come from (using
request.form("variablename")) and there is no way to get data from one
of the other frames on the page?

So what I tried to do is go to a client-side function within the
bottom frame when a button is pressed. This function will get the
value from the middle frame and store it in a hidden field on the
bottom frame. This is the bit I can't figure out how to do!!!! The
function call works but my attempt at getting the data out of the
other frame fails miserably! I'm trying using

parent.frames["rundetails"].document.form1.id

id is the name of the variable I need and form1 is the name of my form
within the rundetails frame.

I'm using VBScript to do this.

Where am I going wrong??

Yours hopefully!
Kathryn.
 
T

Tom B

a) How did the data from the middle frame get there? Did your code put it
there? If so, you could put the value in a Session variable.
b) In your bottom frame add a hidden input -- <input type=hidden
name=HiddenValue value=""> -- Using Client side code add an event handler
for the onSubmit function that populates the value of your Hidden form
field.
 
K

KP

Thank you for your response. The data got into the middle frame from a
database call. Each row returned from the database has its unique key
attached to it and when the user selects the row they want to, for
example, edit the contents of it is this key I want to pass to the other
ASP.

Thinking about it, with your suggestion, I could put an event on the
selection of the record and store it in the session at that point. This
could then be accessed in the other ASP.

I'll give that a go, thanks for your idea!

It would be nice, however, to be able to access the data in the other
frame without having to do this as there may come a time when I want to
get more than one piece of data and don't really want to clutter up the
session with loads of data. So, if anyone knows how to do this then that
would be great!

Thanks again.
 
K

Keith

-----Original Message-----
I hope you can help as this is driving me crazy!

I have an asp which has 3 frames on it as follows:

<FRAMESET rows="50%,*,10%">
<FRAME src="rundetailstop.asp" name="rundetailstop" scrolling="no">
<FRAME src="rundetails.asp" name="rundetails" scrolling="auto">
<FRAME src="rundetailsbottom.asp" name="rundetailsbottom"
scrolling="no">
</FRAMESET>

The top frame(rundetailstop) is the heading, the middle
frame(rundetails) has the data within a form and the bottom
frame(rundetailsbottom) has some buttons on it within a form.

When a button is clicked in the bottom frame it submits the form and
goes off to a different ASP to do some processing. The problem is that
I need to take one piece of data from the middle form with me. The
middle frame has a textfield which contains a number I need to take
with me.

I'm assuming in the ASP I go off to when the button is clicked I can
only get the data from the form the request has come from (using
request.form("variablename")) and there is no way to get data from one
of the other frames on the page?

So what I tried to do is go to a client-side function within the
bottom frame when a button is pressed. This function will get the
value from the middle frame and store it in a hidden field on the
bottom frame. This is the bit I can't figure out how to do!!!! The
function call works but my attempt at getting the data out of the
other frame fails miserably! I'm trying using

parent.frames["rundetails"].document.form1.id

id is the name of the variable I need and form1 is the name of my form
within the rundetails frame.

I'm using VBScript to do this.

Where am I going wrong??

Yours hopefully!
Kathryn.
.

I agree with "Tom B", that if you can do it from server-
side script that is the better choice. However, if you
still need the client-side, the following javascript works
for me:

Id = top.document.frames('rundetails').Form1.Id.value;

this will put the data in the variable "Id", from which
you can do whatever with it. Remember that Javascript is
case sensitive though.

Good Luck
 
K

KP

Thanks for your help. Unfortunately it seems I can't do this server-side
no matter how I try so I'm going to have to use client-side.

Thanks for your javascript, I'm using VBScript so do you happen to know
what the equivalent would be in VBScript?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,356
Latest member
Tommyhotly

Latest Threads

Top