View Full Version : Transfer information in a form on one page to a form in another page

08-25-2005, 02:07 AM
I want to have 3 pages, page one having a hidden form to store information, this page will have links on it to open the other two pages, page 2 will put information into the hidden fields (I have this part working), now I need get page 3 to get the information and put it in a hidden form in page 3 which can then be put in visable fields in a iframe in page 3.

Here is the form in page 1:

<form name='form1'>
<!--This is a hidden form in page 1 that holds data for page 3.-->
<input name='information1' value="" type="hidden">
<input name='information2' value="" type="hidden">
<input name='information3' value="" type="hidden">

Here is the function in page 2 to put the information into page 1:

function updateform1(field,txt) {
// This function updates the hidden fields in form1 so I can call it from page 3.
if (opener.form1) {
switch (field) {
case "data1" : opener.form1.information1.value = txt;
case "data2" : opener.form1.information2.value = txt;
case "data3" : opener.form1.information3.value = txt;

And this is the Function call for the above function:

<input class="text" type=text name="information1" onChange=updateform1("data1",this.value)>
<input class="text" type=text name="information2" onChange=updateform1("data2",this.value)>
<input class="text" type=text name="information3" onChange=updateform1("data3",this.value)>

which works and successfully puts the information in the form in page 1, but I am having problems getting the data from page 1 to page 3

Here is the function that I am trying to use to get the data from page 1:

function getform1data(){
// This fuction tries to get the data from page 1
form2.data1.value = opener.form1.information1.value;
form2.data2.value = opener.form1.information2.value;
form2.data3.value = opener.form1.information3.value;

Here is the Call in page 3 for the Above Function:

<a onClick="getform1data()">Get Form Data</a>

And this is the form in page 3 that is supposed to accept the data from the above function:

<form name='form2'>
<!--This is a hidden form in page 3 to accept the information from page 1.-->
<input name='data1' value="" type="hidden">
<input name='data2' value="" type="hidden">
<input name='data3' value="" type="hidden">

Here is the Frame that will be in page 3:

<iframe name="content" width="100%" height="100%" frameborder="0" src="frame1.html"></iframe>

Here is the function in the frame to get the data from page 3:

function getform2data(){
// This fuction tries to get the data from form2.
f.data1.value = parent.form2.data1.value;
f.data2.value = parent.form2.data2.value;
f.data3.value = parent.form2.data3.value;

If anyone can help me with this please let me know.

08-25-2005, 03:11 PM
Do you get any error messages with this code? I noticed that you're just referring to your form as "form2", "f", etc., when you should be using document.form2, document.f, etc.

Post any errors you're getting, and also whether or not you are doing what I described above.

08-26-2005, 04:54 AM
I didn't see that there was an error because I was opening up page 2 and 3 in windows that don't have status bars and I didnt' have it set to open an error box each time there is an error in the javascript, I added the document to it and now it works, but I still cannot get it to transfer to the iframe that is in page 3, mabye it is because the source for the iframe is an internet page, while page 3 itself is local?

Well thankyou for the help

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum