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 5 of 5
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    190
    Thanks
    1
    Thanked 2 Times in 2 Posts

    popup from data to be placed in opener form

    i have a form with a location row. in that row there is dropdown box with all of the current locations. next to that dropdown i have a link that will launch another form, in a popup window to add a location to that list.

    the popup, add location form, is a two page process - manage_sites.php and manage_sites_process.php.

    in manage_sites_process.php, after all of the info is inputted into the db, i set up some javascript to draw a new dropdown with the new location added.

    my problem is that 'opener' doesnt exist or cannot be found

    PHP Code:
    <?
    if($processType == "popupAdd"){
                    
    $newDrop LmsDropDowns::getSiteHTMLSelectBox('site_id'$cID);
                    
    $script  "alert('asdfasdfas'); function new_drop(){opener.document.manageClassForm.document.getElementById('locationCell').innerHTML = $newDrop;}"
                    
    $load      "onload = function(){ new_drop(); }";
                }
    ?>
    $newDrop returns the html for the dropdown and i figured the function new_drop() would just replace whatever is in the locationCell with the new dropdown info.

    what am i doing wrong?
    thanks

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,512
    Thanks
    3
    Thanked 504 Times in 491 Posts
    to make sure I understand

    are you trying to change the code in the parent(opener) from a popup?
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    Regular Coder
    Join Date
    May 2005
    Posts
    190
    Thanks
    1
    Thanked 2 Times in 2 Posts
    yes wvphil.


    i just want to replace the content of the locationCell field with the html stored in $newDrop

  • #4
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,512
    Thanks
    3
    Thanked 504 Times in 491 Posts
    well this works

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    </head>
    <body>
    <input type="button" name="" value="PopUp"
     onclick="mw=window.open('co1.htm','ggg','width=200,height=200,left=20,top=20');" />
    <div id="fred" ></div>
    </body>
    
    </html>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    </head>
    <script language="JavaScript" type="text/javascript">
    /*<![CDATA[*/
    function CngOpener(){
     opener.document.getElementById('fred').innerHTML='some HTML';
    
    }
    
    /*]]>*/
    </script>
    <body onload="CngOpener()">
    <input type="button" name="" value="PopUp"
     onclick="mw=window.open('co1.htm','ggg','width=200,height=200,left=20,top=20');" />
    <div id="fred" ></div>
    </body>
    
    </html>
    so check the rendered HTML of your parent and popup
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #5
    Regular Coder
    Join Date
    May 2005
    Posts
    190
    Thanks
    1
    Thanked 2 Times in 2 Posts
    cool that works.

    i was trying to reference the form then do doc.getele, etc etc.

    thank you sir


  •  

    Posting Permissions

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