I have a php page which displays a list of products using a list box. When clicking an ADD button, a new PHP page is popped up and display with a list of products which have not been chosen. When an item is selected and the form is submitted, I use a bit of javascript to move the selected items to the form behind.
It works on Navigator 7 and Operator 6.04, but not IE6 SP1. IE6 gives an exception error.
The pop-up form uses the OPENER object so that the form can pass the selected items back.
I have attached a simple version of the two PHP forms.
Can anyone help please. I am becoming a bit desparate now.
Thanks in advance.
BB
Code is:
EXTRACT INTO FIRST.HTML
<HTML>
<HEAD>
<TITLE>Your Order</TITLE>
<SCRIPT LANGAUGE="JavaScript">
<!--
function newWindow( file, window) {
msgWindow=open(file,window,'resizable=no,width=200,height=400');
if (!msgWindow.opener == null) msgWindow.opener = self;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM METHOD="POST" NAME="order">
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
<TR>
<TD WIDTH="11%"><SELECT SIZE="6" NAME="destlist">
<OPTION VALUE="1">Apples</OPTION>
<OPTION VALUE="3">Oranges</OPTION>
<OPTION VALUE="2">Pears</OPTION>
</SELECT></TD>
<TD WIDTH="89%" ALIGN="left" VALIGN="top"><INPUT TYPE="button" VALUE="Show Fields" NAME="showfields" onClick="newWindow('second.html','window2');"></TD>
</TR>
</TABLE>
<P> </P>
</FORM>
</BODY>
</HTML>
EXTRACT ALL BELOW INTO SECOND.HTML
<HTML>
<HEAD>
<TITLE>Select Available Items</TITLE>
<SCRIPT LANGAUGE="JavaScript">
<!--
function setForm() {
var intCount = 0;
var objDestList = opener.document.order.destlist;
var objList = document.availableitems.sourcelist;
for (var intCount = 0; intCount < objList.options.length; intCount++) {
var objItem = objList.options[intCount];
if (objItem.selected) {
objDestList.options[objDestList.options.length] = new Option(objItem.text, objItem.value, false, false);
}
}
self.close();
return false;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM METHOD="POST" NAME="availableitems" onSubmit="return setForm();">
<TABLE BORDER=" 0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">
<TR>
<TD WIDTH="12%"><SELECT SIZE="6" NAME="sourcelist">
<OPTION VALUE="4">Bananas</OPTION>
<OPTION VALUE="5">Peaches</OPTION>
<OPTION VALUE="6">Strawberries</OPTION>
</SELECT></TD>
<TD WIDTH="88%" ALIGN="left" VALIGN="top"><INPUT TYPE="submit" VALUE="Update List" NAME="updatelist"></TD>
</TR>
</TABLE>
<P></P>
<P> </P>
</FORM>
</BODY>
</HTML>