1

I'm implementing the autocomplete and want the minLength option to be something like 3 or 4. I've added a spinner that displays when the remote search is fired and hides when the remote search returns. However, if the user types in less than the minLength number of characters and is expecting it to search they may sit there for a while wondering why the search isn't happening.

I'd like to indicate to the user that they've not met the minimum threshhold and encourage them to keep typing. I'd like to do it by displaying a tooltip like "please enter at least n characters" for the text input the autocomplete is on, but only after some amount of time (like 1 sec.) after they type the last character.

My question is whether there's an elegant way to use the autocomplete API to accomplish this or whether I just need to have a separate piece of JavaScript that hooks the onkeyup and sees if it's been long enough to initiate the tooltip. I didn't spot anything in looking at the autocomplete API that looked useful. Maybe this would be a good opt-in feature suggestion to the jQuery UI team for a future release.

jinglesthula
  • 4,446
  • 4
  • 45
  • 79

1 Answers1

1

Only way I can think of doing this is by extending autocomplete: https://stackoverflow.com/a/13763473/1235702

If you don't want to bother going that way, I'm afraid you might be stuck with your onkeyup hack.

Community
  • 1
  • 1
brokethebuildagain
  • 2,162
  • 1
  • 22
  • 44