rjusa
11-19-2003, 08:40 AM
Here's what I've got that works:
a parent form 'forms[0]' that opens a child '<form name="childForm">'...
in the child a drop down box that allows for multiple selections...'<select name="select1" size="5" multiple>
<option name="option1" value="Alabama">Alabama</option>
<option name="option2" value="Alaska">Alaska</option>
.
.
</select>'
a script routine that takes the selections from the drop down and assigns them to a new name 'function States5Year() {
if (document.childForm.select1.options[0].selected)
document.childForm.state1.value=document.childForm.select1.options[0].value;
if (document.childForm.select1.options[1].selected)
document.childForm.state2.value=document.childForm.select1.options[1].value;
.
.
}
</script>'
a 5x1 table with text boxes to check if the selections are being assigned correctly '<input type=textbox size="16" name="state1" value="">'
.
.
Ok, so I make my selections and click a button '<input type="button" value="States" name="States5" onClick="States5Year()">' and sure enough the selections now appear in the text boxes so I'm assuming that the value(s) state1, etc DO EXIST!
Sooo, I want to pass these values back to parent 'function updateParent(childForm) {
opener.document.forms[0].state1.value = document.childForm.state1.value;
opener.document.forms[0].state2.value = document.childForm.state2.value;
.
.
self.close();
return false;
}
Well, when I click the button <form name="childForm" onSubmit="return updateParent(this);"> the selections in the drop down are cleared, the text boxes are cleared, nothing is tranfered over to the parent and I'm still in the child! Where did I screw up? This is driving me nuts.
Oh yeah, if I take out the drop down and just type in the states in the child text boxes, the values get passed to the parent and the child closes! I must be close! (Maybe?)
Thanks,
Ron
a parent form 'forms[0]' that opens a child '<form name="childForm">'...
in the child a drop down box that allows for multiple selections...'<select name="select1" size="5" multiple>
<option name="option1" value="Alabama">Alabama</option>
<option name="option2" value="Alaska">Alaska</option>
.
.
</select>'
a script routine that takes the selections from the drop down and assigns them to a new name 'function States5Year() {
if (document.childForm.select1.options[0].selected)
document.childForm.state1.value=document.childForm.select1.options[0].value;
if (document.childForm.select1.options[1].selected)
document.childForm.state2.value=document.childForm.select1.options[1].value;
.
.
}
</script>'
a 5x1 table with text boxes to check if the selections are being assigned correctly '<input type=textbox size="16" name="state1" value="">'
.
.
Ok, so I make my selections and click a button '<input type="button" value="States" name="States5" onClick="States5Year()">' and sure enough the selections now appear in the text boxes so I'm assuming that the value(s) state1, etc DO EXIST!
Sooo, I want to pass these values back to parent 'function updateParent(childForm) {
opener.document.forms[0].state1.value = document.childForm.state1.value;
opener.document.forms[0].state2.value = document.childForm.state2.value;
.
.
self.close();
return false;
}
Well, when I click the button <form name="childForm" onSubmit="return updateParent(this);"> the selections in the drop down are cleared, the text boxes are cleared, nothing is tranfered over to the parent and I'm still in the child! Where did I screw up? This is driving me nuts.
Oh yeah, if I take out the drop down and just type in the states in the child text boxes, the values get passed to the parent and the child closes! I must be close! (Maybe?)
Thanks,
Ron