473,320 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

listbox selection to autopopulate fields?

Hi folks,

I'm in the middle of adding some validation functionality to an inventory
tracking form.

What I would like to do is have one dropdown menu/Listbox(Part Number) and
another text field (Product Description).

When the user selects an item from the drop down (IE 12S0FB) it will
autopopulate the text field with a description of the product. At the
moment I will hard code the values in. Can anyone help me out here?

Thanks,
Dave
Jul 23 '05 #1
2 3642

Dave <ov******@cogeco.ca> wrote in message
news:Gg*************@read1.cgocable.net...
Hi folks,

I'm in the middle of adding some validation functionality to an inventory
tracking form.

What I would like to do is have one dropdown menu/Listbox(Part Number) and
another text field (Product Description).

When the user selects an item from the drop down (IE 12S0FB) it will
autopopulate the text field with a description of the product. At the
moment I will hard code the values in. Can anyone help me out here?

Thanks,
Dave


Let's say you've created an array of description strings named descs, your
form is called form1 and it contains a textarea named descText.

<select onchange="document.form1.descText.value=descs[this.selectedIndex]">

--
S.C.
Jul 23 '05 #2
Dave wrote:
Hi folks,

I'm in the middle of adding some validation functionality to an inventory tracking form.

What I would like to do is have one dropdown menu/Listbox(Part Number) and another text field (Product Description).

When the user selects an item from the drop down (IE 12S0FB) it will
autopopulate the text field with a description of the product. At the moment I will hard code the values in. Can anyone help me out here?

Thanks,
Dave


Use an object (not an array) to map part numbers to descriptions:

var p_desc = {
'IE 12S0FB' : 'Giant Veeblefetzer' ,
'IE 76S0GB' : 'Tiny Veeblefetzer' ,
.........
'IE 22340x' : 'Blue Klarn'
}

Then...

<select...onchange="product_description.value=(p_d esc[this.options[this.selectedIndex].value]||'')">
<option value="">choose</option>
<option value="IE 12S0FB">IE 12S0FB</option>
.........
</select>
<textarea name="product_description"></textarea>

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James Goodman | last post by:
I have a listbox named sub1 on an asp page. I need to fill this list with values from a table. These are selected based upon the selection of a value/s in another listbox. It was suggested that I...
1
by: Annette Massie | last post by:
I would like to have a form that lists current addresses being used. On this form I would also like to have a command button that would allow the user to add an address if they do not see it...
8
by: Bill | last post by:
I'm trying to create a wizardlike interface using a couple listboxes. I know you've seen it before. You double click on an item in one listbox and it "moves" it to the other. I used to approach...
2
by: sajones | last post by:
Hello, I'm a novice user having troubles retrieving data from a listbox in VB Express 2005. My listbox is populated by a table from an Access database. I'm trying to assign the current...
0
by: Sanjin | last post by:
I have populated listbox with data from the datatable. I binded SelectedValue to the another datatable - i.e. selection result (with VS 20005 wizard). Selection result datatable has...
5
by: aharding | last post by:
I would like to autopopulate fields in a form by choosing one value from a table and having the corresponding data filled in based on 'Library' tables I have made. I have been successful in building...
7
by: bloukopkoggelmander | last post by:
Hi all Now this seems staright forward, but I am having loads of problems getting this to work. What I want to do is to have two combo boxes . The user makes a selection in the top one and then...
1
by: asharma0001 | last post by:
Hi all, I was wondering whether somebody might be able to help me with a question I have on a MS Access Database I'm building. I have created a search form with a few multiselect listboxes....
4
by: kimiraikkonen | last post by:
Hi, I have a odd but a known question about listbox. I know listbox control can provide multi-select, multi-extendend selections. But i wonder if this selection type belongs to them or it has...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.