Forum Moderators: open
in the pop-up script:
<form name="GebNaam">
<script language="JavaScript"><!--
function updateOpener() {
opener.document.Storing.vld_GebrNaam.value = document.GebNaam.hidden_GebrNaam.value;
opener.document.Storing.submit;
window.close();
}
//--></script>
<input type="hidden" value="<?php echo stripslashes($_SESSION['row']['GebrNaam']);?>" name="hidden_GebrNaam" size="1">
<?php
echo '<a href="javascript:updateOpener()" title="Gebruikersnaam">'.stripslashes($_SESSION['row']['GebrNaam']).'</a>';
?>
on my main screen there is a
<form name="Storing">
with a field vld_GebrNaam (type=input)
when I click on the link in the pop-up screen (defined in the php code), I expect the pop-up to close (that works) and that the value which belongs to the link (in the hidden field) will be placed in the input field vld_GebrNaam on the main screen
however.. the value from the pop-up is not transfered to the main screen, it shows up as "undefined".
why is it "undefined"?
as far as I can tell I'm doing it correctly now :(
is there something wrong with that identifier then?
below is a part of the code of the pop-up script, as it is now.
<script language="JavaScript"><!--
function updateOpener() {
top.window.opener.document.Storing.vld_GebrNaam.value = document.GebNaam.hidden_GebrNaam.value;
window.close();
}
//--></script>
<form name="GebNaam" method=post>
<table summary="Overzicht werkstations" border="0" cellpadding="0" cellspacing="0" width="573">
<tr bgcolor=#6699cc>
<td width=2 class="normaletekst_alternatief"></td>
<td width=115 class="normaletekst_alternatief">Gebruiker</td>
<td width=150 class="normaletekst_alternatief">Vol.Naam</td>
<td width=140 class="normaletekst_alternatief">Afdeling</td>
<td width=166 class="normaletekst_alternatief">E-mail</td>
</tr>
<?php
for ($i = 0; $i < $num_results ; $i++)
{
$_SESSION['row'] = mysql_fetch_array($result);
?>
<tr>
<td class="kleinetekst_11">
</td>
<td class="kleinetekst_11">
<input type="hidden" value="<?php echo stripslashes($_SESSION['row']['GebrNaam']);?>" name="hidden_GebrNaam" size="1">
<script language="javascript">alert(document.GebNaam.hidden_GebrNaam.value);</script>
<?php
echo '<a href="javascript:updateOpener()" title="Gebruikersnaam">'.stripslashes($_SESSION['row']['GebrNaam']).'</a>';
?>
</td>
<td class="kleinetekst_11">
<?php echo stripslashes($_SESSION['row']['VolNaam']);?>
</td>
<td class="kleinetekst_11">
<?php echo stripslashes($_SESSION['row']['NaamAfd']);?>
</td>
<td class="kleinetekst_11">
<?php echo stripslashes($_SESSION['row']['EmailAd']);?>
</td>
</tr>
<?php
}
// <script language="javascript">alert(document.GebNaam.hidden_GebrNaam.value);</script>
?>
</table>
</form>
<script language="JavaScript"><!--
function updateOpener(valuetouse) {
window.opener.Storing.vld_GebrNaam.value = window.opener.Storing.vld_GebrNaam.value+ ' ' +valuetouse;
opener.document.Storing.submit;
window.close();
}
//--></script>
<form name="GebNaam" method=post>
<table summary="Overzicht werkstations" border="0" cellpadding="0" cellspacing="0" width="573">
<tr bgcolor=#6699cc>
<td width=2 class="normaletekst_alternatief"></td>
<td width=115 class="normaletekst_alternatief">Gebruiker</td>
<td width=150 class="normaletekst_alternatief">Vol.Naam</td>
<td width=140 class="normaletekst_alternatief">Afdeling</td>
<td width=166 class="normaletekst_alternatief">E-mail</td>
</tr>
<?php
for ($i = 0; $i < $num_results ; $i++)
{
$_SESSION['row'] = mysql_fetch_array($result);
?>
<tr>
<td class="kleinetekst_11">
</td>
<td class="kleinetekst_11">
<?php
//<script language="javascript">alert(document.GebNaam.hidden_GebrNaam.value);</script>
//echo '<a href="javascript:updateOpener()" title="Gebruikersnaam">'.stripslashes($_SESSION['row']['GebrNaam']).'</a>';
$loopvalue=stripslashes($_SESSION['row']['GebrNaam']);
echo "<a href=\"javascript:updateOpener('$loopvalue');\" title=\"Gebruikersnaam\">$loopvalue</a>";
?>
</td>
<td class="kleinetekst_11">
<?php echo stripslashes($_SESSION['row']['VolNaam']);?>
</td>
<td class="kleinetekst_11">
<?php echo stripslashes($_SESSION['row']['NaamAfd']);?>
</td>
<td class="kleinetekst_11">
<?php echo stripslashes($_SESSION['row']['EmailAd']);?>
</td>
</tr>
<?php
}
// <script language="javascript">alert(document.GebNaam.hidden_GebrNaam.value);</script>
?>
</table>
</form>
with kind thanks to " rfila "