1

I've read through nearly all the posts on jQuery UI autocomplete, but I still can't figure this out.

If there isn't a match, I need to append an item to the list that says something like:

Create an entry for "Search Term Being Entered"

so it can be selected and I can run a function to deal with a new entry.

The problem I'm having is figuring out which event I need to hook into to update the menu and list.

insumity
  • 5,311
  • 8
  • 36
  • 64
neil
  • 287
  • 2
  • 4
  • 13

2 Answers2

2

This question may point you in the right direction:

Detecting no results on jQuery UI autocomplete

Be sure to look at the fiddle in Andrew's answer:

http://jsfiddle.net/andrewwhitaker/VBTGJ/

Community
  • 1
  • 1
jk.
  • 14,365
  • 4
  • 43
  • 58
0

Wouldn't the server normally decide if the user entered a 'new item'?

I'm just making some basic assumptions here about your environment. The auto-complete list comes from some MySQL data. So the server should know if a term is new. Never trust user input from the client.

An autocomplete UI is not a way to force a certain input, it's merely a tool for the user to reuse existing or common values. The actual interpretation should happen on the server.

Halcyon
  • 57,230
  • 10
  • 89
  • 128
  • Yes - but if the search term isn't found in the list returned from the server (or local array), I still need a selectable item in the list instead of just closing the menu. – neil Jun 11 '11 at 23:09