Click to See Complete Forum and Search --> : a little help...almost there!


rjusa
11-19-2003, 01:46 PM
In my seemingly never ending battle to pass multiple drop down selections from a child to parent I've almost got it... my parent code is:

*****
<script language="JavaScript"><!--
function myopen() {
popupWindow=open('TestMchild.html','windowName','resizable=no,width=400,height=300');
if (popupWindow.opener == null) popupWindow.opener = self;
}
//--></script>

<form>
<input type="text" size="40" name="resultfield">
<input type="button" value="Open" onClick="myopen()">
</form>
***

my child code is:
***
<script language="JavaScript"><!--
function update() {
var output = '';

for (var i=0;i < document.forms[0].selectfield.options.length;i++) {
if (document.forms[0].selectfield.options[i].selected) {
output += document.forms[0].selectfield.options[i].text + ' ';
}
}

opener.document.forms[0].resultfield.value = output;
window.close();
}
//--></script>

<form onSubmit="return false">
<select multiple name="selectfield">
<option>Monday
<option>Tuesday
<option>Wednesday
<option>Thursday
<option>Friday
<option>Saturday
<option>Sunday
</select>
<p>
<input type="button" value="Update" onClick="update()">
</form>
***

What happens is the selected values are finally passed BUT into a single textbox ('resultfield'...e.g., Monday, Tuesday, Wednesday) What I need to do is put each selection in its own textbox so guess I would have siomething like 'resultfield1'=Monday, 'resultfield2=Tuesday, etc. I'm lost at this point and actually have surprised myself I've gotten this far. Help would be greatly appreciated.

Thanks,
Ron

Mr J
11-19-2003, 05:10 PM
You might find the information you need here

www.huntingground.freeserve.co.uk/scripts/passdata/p_data1.htm