It is breaking/erroring at:
var oOption = window.opener.document.createElement("OPTION");
This is a pop-up window select menu that when a value is chosen will
populate the parent window select menu.
Does oOption need to reference the form[0] and the varEl?
How does it know what form to create an option for?
I see the 4th line trys to do this:
window.opener.form[0].elements[varEl].options[window.opener.form[0].elements[varEl].options.length]
= oOption;
The error I am getting is:
Error: 'undefined' is null or not an object.
function onCarrierSelect() {
var frm = document.carrRequestForm.carrierList.selectedIndex ;
var selectCar =
document.carrRequestForm.carrierList.options[frm].text;
var varEl = "<%=varElementName%>";
if (window.opener && !window.opener.close)
var oOption = window.opener.document.createElement("OPTION");
// assigns object name to create Option tag
oOption.innerText =selectCar;
oOption.value =selectCar;
window.opener.form[0].elements[varEl].options[window.opener.form[0].elements[varEl].options.length]
= oOption;
window.close();
}
jojowebdev@gmail.com wrote:
Quote:
Picking up from Friday..
I am still having trouble creating the Select Menu option. I got parts
of the correct syntax but it is still not creating the selected carrier
as an option in the parent page.
>
Help apprecitate,. I currently have it commented out just to show the
line to you better:
>
function onCarrierSelect() {
var frm = document.carrRequestForm.carrierList.selectedIndex ;
var selectCar =
document.carrRequestForm.carrierList.options[frm].text;
var varEl = "<%=varElementName%>";
if (window.opener && !window.opener.close)
var oOption = window.opener.document.createElement("OPTION");
// window.opener.form.[varEl].options.add(oOption);
oOption.innerText =selectCar;
oOption.value =selectCar;
window.close();
}