Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass value from Iframe to asp page

Status
Not open for further replies.

thankgodfortektips

Programmer
Dec 20, 2005
95
KY
Hi All,

I posted a question a while back about how to stop my page jumping once submited. I can not find that post but long story short I was directed into using Iframes.

I have managed to figure out the iframes, how ever I can not get the values from the iframe to be submitted to the database with the fields from the asp page.

I have tried request.form("field"), I dont get an error, but nothing is submitted...

Any body any idea how I get the values from the iframe?

Thanks in advance
 
What have it to do with iframe or parent? If a page submits data to the server, those data should be ready one form or another through various form elements before submitting. Therefore, the form element named "field" is not readily populated by the time of submission.
 
I am not sure what you mean tsuji...

Maybe if I explain a little better. I have 3 pages, Main.asp, pickup.asp, dropoff.asp. I have pickup.asp and dropoff.asp as iframes on main.asp. The reason I am using iframes is that pickup.asp and dropoff.asp have a list box at the top and then address fields below. If an address is selected from the listbox, the form is submitted and there is an if statement for the value of each field saying that if the list box is not null then populate the text box's with values corresponding to the list box.

Then when main.asp is selected I want it to take the values in the address fields from pickup.asp and dropoff.asp and submit it with the rest of the data from main.asp.

I can not make pickup.asp and dropoff.asp submit the data to the db as the address can be changed main times...

Thanks in advance
 
When you initialize the page, does Main.asp load pickup.asp into the frame?

If not when does it load? Have you tried to pass the data into the pickup page by creating session variables on the main.asp page?
It will use a little more overhead but you can create variables that are equal to the session when you load the pickup/dropoff pages.

You can then write the variable to the DB. If you are using a lot of "fields" then you can create an array and parse it on the pickup page.

Don't know if this will help or not. Good Luck
 
Hey Cirrus9... thanks for the help... but after many hours of surfing I went with using javascript.

When the submit button is clicked on main.asp I run some javascript to take the values from the iframe and put them into matching hidden fields on main.asp.... e.g.
*************************************************
var x = document.getElementById('PickCompanyName')
x.value = document.frames("iframePickUp").document.forms("form1").elements("PickCompanyName").value;

var x = document.getElementById('PickName')
x.value = document.frames("iframePickUp").document.forms("form1").elements("PickName").value;
*************************************************

Thanks anyway! Hope this can help someone else!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top