I have a simple JQuery Autocomplete with a list from the database. My question is not of technical nature, but of usability.

How do you respond to a user pressing the Enter key when the search key is incomplete.


I have three items, ABC ABD and ACE.

I typed AB and two items appeared, but I pressed Enter instead of selecting the specific item from the list using the mouse.

Commonly, it will throw an exception. I am thinking of handling it with no response, or give him a feedback of "No customer found.".

3 Answers 3


Don't complete on enter, this will make people crazy if they want to search for shorter strings!

What you could do is showing them if their string will produce any results on-the-fly

Many websites check your chosen username for availability while you type it.

  • Edit: You can supply some selection and then allow to select it with enter, but never auto-select the first entry on enter.
  • 7
    This, a thousand times this. I hate trying to search for something short and end up searching for something much longer and completely unrelated. Commented Dec 13, 2013 at 13:56
  • 1
    This is also why so many auto-complete softwares suck. You're typing away and end up with total crap...
    – K..
    Commented Dec 13, 2013 at 14:47
  • 5
    even google chrome is terrible at this, i search for a specific term like 'google maps place pointer' then when i go to search for 'google maps' i get the first search repeated ! I've actually submitted this to them as a UX bug
    – Toni Leigh
    Commented Dec 13, 2013 at 21:12

If selection is made exclusively from the list, you could auto-select first item. Then Enter will pick this item if user have not changed selection.
enter image description here

  • If only this was standard everywhere!
    – uxfelix
    Commented Dec 13, 2013 at 12:10
  • Beware that it's not immediately obvious if the choices are only valid from the list or not, some people would expect that pressing enter would execute the query on what they have entered (I think facebook search would be an example) and not the 1st item, even though it might be highlighted.
    – frozenkoi
    Commented Dec 14, 2013 at 0:04
  • I'd strongly suggest showing the rest of the highlighed selection in the text-box in a different colour. {Ab}[black](carat){cde}[light grey]. This makes it clearer that hitting enter will effectively search for the selected item, rather then the entered text. Note that this is only a good idea if the only valid entries are the ones shown in the drop-box.
    – Fake Name
    Commented Dec 15, 2013 at 16:17
  • @FakeName, please note, Google does it just in the opposite way in suggestions. This lets to focus on the rest letters to distinct options more clear. Typed letters are in user's mind already, so they make accent on the rest ones ). Commented Dec 15, 2013 at 17:22

I think the answer depends on how your widget and search works:

  1. In case you can search for partial results, you shouldn't automatically autocomplete the field, as the user might just wanted to search for the substring he entered (in the above case he wanted everything starting with AB). For this you probably have a combobox style widget, where you can enter any string, or choose from a list.

  2. In case the search is exact (I think in your example this is true), then however there is no use of searching for something that you already know it wont exist, so you should pick the first element. This probably means you have a selectbox style widget, where you can only select from the elements provided. However, you should re-think how searches work, as this means the user wouldn't be able to search for elements starting with AB directly, only by using the autocomplete field and actually selecting an element. This might not be waht you want.

  • Yes, it definitely comes down to whether the autocomplete function is on a closed list of options or an open-ended search Commented Dec 14, 2013 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.