/    Sign up×
Community /Pin to ProfileBookmark

a little help…almost there!

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

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JNov 19.2003 — You might find the information you need here

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

Success!

Help @rjusa spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...