Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Transfer information in a form on one page to a form in another page

    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:
    Code:
    <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">
    </form>
    Here is the function in page 2 to put the information into page 1:
    Code:
    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;
    		break;
    		case "data2" : opener.form1.information2.value = txt;
    		break;
    		case "data3" : opener.form1.information3.value = txt;
    		}
    	 }
    }
    And this is the Function call for the above function:
    Code:
    <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:
    Code:
    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:
    Code:
    <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:
    Code:
    <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">
    </form>
    Here is the Frame that will be in page 3:
    Code:
    <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:
    Code:
    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.

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    Kentucky
    Posts
    133
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.

  • #3
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Kingofnerds


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •