PDA

View Full Version : Autocompleting on the beginning of every word



yaron
14 Jul 2007, 7:47 PM
Hi,

I'm wondering: is it possible to set a ComboBox to autocomplete on the beginning of every word, if the values in the list contain more than one word? Or, for that matter, to autocomplete on every letter in the value? I'm imagining a configuration where, for a list of U.S. states, entering "I" would give you not just the states that start with "I" but also Rhode Island; and, if you configured it differently, maybe even Maine and many other states as well. Or, if it can't be configured that way, how could it be programmed?

Thanks,
Yaron

manugoel2003
15 Jul 2007, 12:49 PM
according to what I get out of it, you need to implement that logic in server side code.

yaron
16 Jul 2007, 7:43 AM
By server-side scripting, do you mean creating an array of autocompletion values for each value, like ["Rhode Island", "Island"], etc.? Or maybe even ["Rhode Island", "hode Island", "ode Island"...]? If so, that seems like a hack. Could there be a better way?

Thanks again,
Yaron

manugoel2003
16 Jul 2007, 10:37 AM
no, I don't mean that..... what I want to say is..... hmmm, lets say the user types "i"..... and lets say that you have various entries in your db like "A island", "B island", "island C", "island D", etc..... then you will get "query=i" in the post/get array in PHP (or JSP or ASP whatever)..... then it is the job of php to fire the right query to the DB and filter out the right records and return them..... the JavaScript will simply display the returned records.....the format of the returned records should be in sync with ur JsonReader or XMLReader.... I hope I am able to convey the idea

yaron
16 Jul 2007, 4:13 PM
Okay, I understand, thanks. But that seems extremely inefficient compared to client-side filtering; I mean, it would just take a few people typing into the autocomplete field to overload the system. There's definitely no way to do it on the client side?

-Yaron

manugoel2003
16 Jul 2007, 9:34 PM
client-side filtering is possible but I am not sure if this can be done out of the box...... you might have to do some subclassing.... I have no idea