...

View Full Version : popup from data to be placed in opener form



emehrkay
06-01-2006, 03:54 PM
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



<?
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

vwphillips
06-01-2006, 04:09 PM
to make sure I understand

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

emehrkay
06-01-2006, 04:19 PM
yes wvphil.


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

vwphillips
06-01-2006, 04:43 PM
well this works


<!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

emehrkay
06-01-2006, 04:48 PM
cool that works.

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

thank you sir



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum