Hi,
I want to open a popup-window which displays a list to the user. From this
list, the user can select an item, and the data regarding this item is then
transferred to some fields on the main window (and the popup then closes).
But I am having several problems. I have an example "main.html" which opens
an example "lookup.htm l". In the actual application "lookup.htm l" is
generated dynamically be a server, and will have different lists depending
on a "typeid" sent to the server in the request. In the example below I want
the possibility to select from 2 lists: one called FUNCTION, and one called
MATERIAL.
But I can't even get the "function" data to be transferred to the main
window. What is the problem?
Also, what is the easiest way to tell "lookup.htm l" what fields to write to
on the main window? The field names will be different depending on the
particular list shown (I guess I will need to get the server which generates
the lists to also ensure that the javascript on "lookup.htm l" matches the
correct field names etc).
Thanks,
Peter
The MAIN window (main.html):
<html>
<head>
<title>
Test Popup
</title>
</head>
<script language="javas cript">
function newWindow(url,w indow,param)
{
popupWindow=ope n(url, window, param);
if (popupWindow.op ener == null) popupWindow.ope ner = self;
}
</script>
<body>
<table width="100%" border="1" bgcolor="f1f8ff ">
<form method="post">
<tr>
<td valign="top" width="20%">
<b>FUNCTION</b>
</td>
<td valign="top" width="40%">
<input type="button" value="pop"
onclick="newWin dow('lookup.htm l?typeid=5000', 'catalogue','wi dth=500,height= 4
00')" />
<input type="hidden" value="2" name="function" />
<input type="text" value="f2" name="function_ shortcut"
style="width:25 px" />
<input type="text" value="function 2" name="function_ name" />
</td>
</tr>
<tr>
<td valign="top" width="20%">
<b>MATERIAL</b>
</td>
<td valign="top" width="40%">
<input type="button" value="pop"
onclick="newWin dow('lookup.htm l?typeid=5001', 'catalogue','wi dth=500,height= 4
00')" />
<input type="hidden" value="11" name="material" />
<input type="text" value="m1" name="material_ shortcut"
style="width:25 px" />
<input type="text" value="material 1" name="material_ name" />
</td>
</tr>
</form>
</table>
</body>
</html>
An example POPUP window (lookup.html):
<html>
<head>
<title>
Lookup
</title>
</head>
<script language="javas cript">
function choose( id, shortcut, name )
{
window.opener.d ocument.forms[0].function.value = id;
window.opener.d ocument.forms[0].function_short cut.value = shortcut;
window.opener.d ocument.forms[0].function_name. value = name;
window.close();
}
</script>
<body>
<table width="100%" border="1" bgcolor="f1f8ff ">
<tr>
<td valign="top" width="20%">
<b>Lookup List</b>
</td>
<td>
<table width="100%">
<tr>
<td>
<a href="#" onclick="choose (1,'f1','functi on 1')">func 1</a>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="choose (2,'f2','functi on 2')">func 2</a>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="choose (3,'f3','functi on 3')">func 3</a>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="choose (4,'f4','functi on 4')">func 4</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
I want to open a popup-window which displays a list to the user. From this
list, the user can select an item, and the data regarding this item is then
transferred to some fields on the main window (and the popup then closes).
But I am having several problems. I have an example "main.html" which opens
an example "lookup.htm l". In the actual application "lookup.htm l" is
generated dynamically be a server, and will have different lists depending
on a "typeid" sent to the server in the request. In the example below I want
the possibility to select from 2 lists: one called FUNCTION, and one called
MATERIAL.
But I can't even get the "function" data to be transferred to the main
window. What is the problem?
Also, what is the easiest way to tell "lookup.htm l" what fields to write to
on the main window? The field names will be different depending on the
particular list shown (I guess I will need to get the server which generates
the lists to also ensure that the javascript on "lookup.htm l" matches the
correct field names etc).
Thanks,
Peter
The MAIN window (main.html):
<html>
<head>
<title>
Test Popup
</title>
</head>
<script language="javas cript">
function newWindow(url,w indow,param)
{
popupWindow=ope n(url, window, param);
if (popupWindow.op ener == null) popupWindow.ope ner = self;
}
</script>
<body>
<table width="100%" border="1" bgcolor="f1f8ff ">
<form method="post">
<tr>
<td valign="top" width="20%">
<b>FUNCTION</b>
</td>
<td valign="top" width="40%">
<input type="button" value="pop"
onclick="newWin dow('lookup.htm l?typeid=5000', 'catalogue','wi dth=500,height= 4
00')" />
<input type="hidden" value="2" name="function" />
<input type="text" value="f2" name="function_ shortcut"
style="width:25 px" />
<input type="text" value="function 2" name="function_ name" />
</td>
</tr>
<tr>
<td valign="top" width="20%">
<b>MATERIAL</b>
</td>
<td valign="top" width="40%">
<input type="button" value="pop"
onclick="newWin dow('lookup.htm l?typeid=5001', 'catalogue','wi dth=500,height= 4
00')" />
<input type="hidden" value="11" name="material" />
<input type="text" value="m1" name="material_ shortcut"
style="width:25 px" />
<input type="text" value="material 1" name="material_ name" />
</td>
</tr>
</form>
</table>
</body>
</html>
An example POPUP window (lookup.html):
<html>
<head>
<title>
Lookup
</title>
</head>
<script language="javas cript">
function choose( id, shortcut, name )
{
window.opener.d ocument.forms[0].function.value = id;
window.opener.d ocument.forms[0].function_short cut.value = shortcut;
window.opener.d ocument.forms[0].function_name. value = name;
window.close();
}
</script>
<body>
<table width="100%" border="1" bgcolor="f1f8ff ">
<tr>
<td valign="top" width="20%">
<b>Lookup List</b>
</td>
<td>
<table width="100%">
<tr>
<td>
<a href="#" onclick="choose (1,'f1','functi on 1')">func 1</a>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="choose (2,'f2','functi on 2')">func 2</a>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="choose (3,'f3','functi on 3')">func 3</a>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="choose (4,'f4','functi on 4')">func 4</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Comment