/    Sign up×
Community /Pin to ProfileBookmark

drop-down menu stuff

I have a form in Frontpage that has a drop down menu with
a list of part numbers. the name of the dropdown menu
is “partnumber1”. Next to it I have a blank text box and
the name of that is “description1”. I would like it if
when a partnumber from the drop-down menu was selected it
would populate the text box or “description1” with the
proper description. I have an access data base with part
numbers and descriptions, 2 columns named partnumber and
description. What would be the best and easiest way to do
this?

Thanks

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@AdamBrillFeb 14.2003 — Well, first of all you would have to get the database info into javascript. Lets say that after you do that, all of the database information is in two arrays, partnumber and description. Then, the code would look something like this:

<i>
</i>&lt;script language=javascript&gt;
function Update(element,formname)
{
x=0;
ran=false;
do
{
if(partnumber[x]==element.value)
{
ran=true;
break;
}
x++;
} while(partnumber[x])
if(ran)
{
formname.results.value=description[x];
}
}
document.write("&lt;form&gt;");
document.write("&lt;select onclick='Update(this,this.form);'&gt;");
document.write("&lt;option value='SELECT'&gt;Please select&lt;/option&gt;");
x=0;
do
{
document.write("&lt;option value='"+partnumber[x]+"'&gt;"+partnumber[x]+"&lt;/option&gt;");
x++;
} while(partnumber[x])
document.write("&lt;/select&gt;");
document.write("&lt;input type=text name='results'&gt;");
document.write("&lt;/form&gt;");
&lt;/script&gt;


I would suggest that you put something in a <noscript> tag, just in case someone comes to your site that doesn't have javascript enabled...
×

Success!

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