Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Typing entry into pulldown list.

Status
Not open for further replies.

grnzbra

Programmer
Mar 12, 2002
1,273
US
I have an .asp file (vbscript) that has a pulldown list with entries from a table. Is there any way to type the entries into the list and either have them fill in values as the letters are typed in or, if no corresponding values are found, enter the typed-in string into the table?
 
I don't know of a common control that will do this, but I have done something similar in the past where I simulate a drop down list with a text box, a drop down image to the right of the text box and a div underneath.

In more detail:

1. create an image of the arrow on a drop down list (call this arrow.jpg)

2. add a text box and the image to your page:
<input type="text"...><img src="arrow.jpg"...>

3. add a hidden div (id="dList") directly below the text box that will popup when you click on the image (add onclick="document.getElementById("dList").style.display='block'" to the image tag

4. have a hidden select list that includes all selections

5. onkeyup of the text box call a javascript function that will:
i. clear all items in the div
ii. loop through all options in the hidden select list and add matching options to the div

Now, when you save the record, you have to get the text that is entered in the text box and see if it exists in your lookup table.

If it does exist, get the ID of that record and save this in your data.

If it does not exist, add it and get the new ID to save in your data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top