-
December 16th, 2008, 07:49 PM
#1
Auto Complete List Box
I have a list box which contains a list of items. Currently if you type in a character say "L" then you are taken to the first record with this character, if you then type another character say "O" (in list box you now see "LO") it takes you to the first record starting with "O".
How can I get the list box to recognise the characters that are input and go to the record starting with all of the characters?
Any advice is appreciated
-
December 17th, 2008, 03:22 PM
#2
Re: Auto Complete List Box
Since you haven't posted your code, we can't completely understand your situation.
But...The only reason it would be doing that is if you are only passing the most recently pressed character to the AJAX call. Why don't you pass the whole value of the text input?
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
January 6th, 2009, 09:58 PM
#3
Re: Auto Complete List Box
I actually coded a control like this for a web framework last year some time. I literally layered a textbox with no borders over the top of the select box control. The drop down button of the select was sticking out past the edge of the textbox. I also had a 3rd hidden textbox that contained the value I cared about when the form was submitted to the server.
As the user typed into the textbox, I searched the list for the next match and highlighted the remaining auto-filled text so they could keep typing normally over it.
If they select something from the dropdown, I fill in the textbox.
This leaves it up to the user how they want to use the control. I called it an Editable Combo box. This is pretty tricky. First, there are problems with cross-browser rendering and layering, not that these ever go away. Also, this would allow the user to enter values that don't exist in the dropbox. Of course, you could write code that would validate that and not allow it.
Good luck.
Meddle not in the affairs of dragons, human, for thou art crunchy and taste good with ketchup.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|