#1
  1. Newbie :P
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Jan 2001
    Location
    In the PHP Engine :-)
    Posts
    2,880
    Rep Power
    21

    Javascript PopUp Retrieve Data From Frame


    I'm having a wee problem trying to grab some form data submitted from a frame to a pop up using Javascript. The form is sat in the mainFrame of the set and is submitted via an onclick event to a javascript function, which checks the fields and then calls:

    window.open('submit.htm','pop','width=350,height=100,status=yes');

    In the submit.htm file I am trying to reassign the data like so:

    var oform = window.opener.parent.frames['mainFrame'].form.elements;
    document.form.elements["Name"].value = oform["Name"].value; document.form.elements["CompanyName"].value = oform["CompanyName"].value; document.form.elements["Address1"].value = oform["Address1"].value;

    But it just don't wanna happen, I have tried a few variations of:

    var oform = window.opener.parent.frames[i].form.elements;
    var oform = window.opener.parent.form.elements;

    And nothing, anyone know what I am missing here?
    ---------------------
    -- SilkySmooth --
    ---------------------
    Proxy
  2. #2
  3. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Might try:

    document.form.elements.Name.value = opener.document.form.elements.Name.value;
    document.form.elements.CompanyName.value = opener.document.form.elements.CompanyName.value;
    document.form.elements.Address1.value = opener.document.form.elements.Address1.value;

    This is better done, imo, with a querystring.
    Last edited by adios; May 2nd, 2003 at 02:13 AM.

IMN logo majestic logo threadwatch logo seochat tools logo