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,070
  • 7
  • 35
  • 61
neil
  • 287
  • 1
  • 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,229
  • 3
  • 42
  • 56
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
  • 56,029
  • 10
  • 87
  • 125
  • 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