PDA

Click to See Complete Forum and Search --> : HELP!! dynamically populate listbox/drop-down


Whisper
Jun 13th, 2002, 03:09 PM
Here's one for ya:

I have a textbox and a drop-down menu used for a browser-based 'search' application.

I want the user to be able to type in text in the textbox, and have the drop-down menu repopulated on each keypress (by data pulled from a database)

example: there are 10 B words in the database. if the user types B, all the words will pop up in the drop-down. If the user types Br, only the words starting with (or containing) BR will be in the drop-down... get it?

i'm using coldfusion to do the database query (select * from TABLE where WORD LIKE [form.textbox]

ANY IDEAS???
:confused:

Mark Sreeves
Jun 14th, 2002, 06:47 AM
Sounds painfully slow to me!

Each time the user types a letter in the dropdown box the page will have to be refreshed from the server. Yuk!

iamwhisper
Jun 14th, 2002, 02:29 PM
Its an intranet site. bandwidth isn't an issue. any ideas?

iamwhisper
Jun 14th, 2002, 02:34 PM
i wouldnt want the page refreshed, just the items in the listbox... the more i explain it, the more silly and impossible it seems...

as an alternative, i just had the sql query populate the dropdown with all possible values from the database:

(if you're familiar with coldfusion):

<cfquery name="GetItemsForDropDown" datasource="projdec">
select * from MyDatabase
</cfquery>

<select name="MyDropDown">
<cfoutput query="GetItemsForDropDown">
<option value="#OneItem#">#OneItem#</option>
</cfoutput>
</select>
[CODE]

it works, its just not as nice as i'd like it to be :(