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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic List Box

Status
Not open for further replies.

MarciaG

MIS
May 16, 2000
4
US
I need a listbox that is filled by the database and then when the user starts to type it fills the listbox with the first few letters that match.  Kind of like in Outlook when you type in the name of someone for your global address book.  I'm figuring that I need to grab the data from the server and keep it in a recordset on the client side so that the user can use it over and over again.  The listbox may need to be repopulated every time the user goes back and types in another name.  Please let me know if you have any ideas.  
 
It's like this:<br><br>open db connection<br>open recordset <br>'your recordset has to be something like<br>'Select * from table ORDER BY field; <br>'the field need sorted so it will appear sorted in the dropdown)<br><br>&lt;SELECT id=&quot;dropdown&quot;&gt;<br>&lt;% do while not recordset.eof%&gt;<br>&lt;OPTION&gt;&lt;%=recordset(&quot;fieldname&quot;)%&gt;&lt;/OPTION&gt;<br>&lt;%recordset.movenext<br>Loop%&gt;<br>&lt;/SELECT&gt;<br><br>
 
Thanks for your Response.<br><br>The ASP side is the easiest part for me.<br>I understand how to get the data into the listbox.<br>I just need some kind of a function to scroll through the listbox as the person is typing the employee name in the textbox.&nbsp;&nbsp;The function would need to transfer the value of the textbox to the selectindex value of the selectbox as the person is typing it.<br><br>Am I making sense?<br>Any ideas?<br><br>
 
Okay, now we are talking Javascript. What you would have to do is the following:<br><br>your textbox will have to have a &quot;keyup&quot; event. Once something is entered in the textbox, you will check to see what was typed in(get the value of the textbox). I don't know what your experience in Javascript is but this is all client-side from here as you can see. <br>Then get the length of the stuff in the textbox, do a loop, compare the value in the textbox to the value of the options in the select list. <br>It gets a little complexed. I would suggest looking at Javascripts.com or Scriptsearch.com to see if something like this is already out there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top