Click to See Complete Forum and Search --> : Updating selectbox with popup window


zimba
01-24-2003, 09:18 AM
Hi all !

I'm on a funny project, making cool interface with php/javascript

I have a selectbox with customers inside and I'd like to use a popup with a form to add a customer in the list.

The problem is I don't have any idea how to send values between two windows.. can I use windows handles or something ?


Cheers,
zimba

khalidali63
01-24-2003, 09:32 AM
yes.

from child to parent

top.opener.document.formName.elementName.value=your value;

from parent to child

winRef.document.formname.elementName....

Khalid

zimba
01-27-2003, 03:29 AM
thx kalidali,

I've tried this and it works



<script language="JavaScript1.2">
function remote(page_name){
top.opener.location.href = page_name;
}
</script>
<a href="javascript://" onclick="remote('index.php');">Change Location</a>

zimba
01-27-2003, 06:30 AM
Can u tell me why this doesn't work ?


<script language="JavaScript1.2">
function remoteUpdateSelect(oSelect, value, text)
{
var oOption = document.createElement("OPTION");
oOption.value = value;
oOption.selected = 1;
oOption.appendChild(document.createTextNode(text));
oSelect.appendChild(oOption);
}
</script>
<a href="javascript://" onclick="remoteUpdateSelect(top.opener.document.form1.select1);">Add Option in SelectBox</a>