/    Sign up×
Community /Pin to ProfileBookmark

combo box help

i am trying to fill multiple (5) text boxes with one selection of a combo box. i i am looking for each selection to give me different values. i have not coded java script for over 5 years and i have had some luck getting some code for what i want but it still does not do what i need. i have found code that allows me to choose a selection and fill the 5 text boxes but it cannot recognize when a selection is created. I attached a couple files that kind of do what i am looking for. any help would be appreciated. thank you.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@MrNobodyJan 16.2009 — Incomplete, but simple, demo:
[code=html]<form method="POST" action="">
<p><select name="S1" size="1" onchange="if (this.selectedIndex < 1)
{
T1.value = '';
T2.value = '';
T3.value = '';
T4.value = '';
T5.value = '';
}
else
{
var vals = this.options[this.selectedIndex].value.split('|');
T1.value = vals[0];
T2.value = vals[1];
T3.value = vals[2];
T4.value = vals[3];
T5.value = vals[4];
}
return true;">
<option>[select one]</option>
<option value="Apple|Banana|Cherry|Date|Guava">Fruits</option>
<option value="Barley|Maize|Oats|Rice|Wheat">Grains</option>
<option value="Almond|Brazil Nut|Cashew|Hazel Nut|Pecan">Nuts</option>
<option value="Asparagus|Brocholli|Cauliflower|Green Beans|Turnip">Vegetables</option>
</select></p>
<p><input type="text" name="T1" size="20"><br>
<input type="text" name="T2" size="20"><br>
<input type="text" name="T3" size="20"><br>
<input type="text" name="T4" size="20"><br>
<input type="text" name="T5" size="20"></p>
</form>[/code]
×

Success!

Help @mkoch71 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,
)...