         break
       when 9, 13 # tab / enter
         if !@shown
-          if typeof @onenter == "function"
-            @onenter()
-          return
-        @select()
+          @onenter() if typeof @onenter == "function"
+          @add_new() if @allowNew
+          return false
+        else
+          @select()
         break
       when 27 # escape
         @hide()

      @onselect(val, go)
    @add(val)
    @hide()

  show: ->
    pos = $.extend {}, @$element.offset(),

  item: '<li><a href="#"></a></li>'
  onselect: null
  onenter: null
  allowNew: false
  property: 'name'

$.fn.autocomplete_collection.Constructor = AutocompleteCollection
