title: JQuery autocomplete: Uncaught TypeError: Cannot read property 'value' of undefined
body: <p>I'm using <a href="https://github.com/devbridge/jQuery-Autocomplete" rel="nofollow">this jquery autocomplete</a> plugin. But when I search click on a filtered result i get this error:</p>
  
  <p><strong>Uncaught TypeError: Cannot read property 'value' of undefined</strong></p>
  
  <p>Here is the stacktrace from the inspector console:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'value' of undefined
  Autocomplete.onSelect @ jquery.autocomplete.min.js:915
  Autocomplete.select @ jquery.autocomplete.min.js:850
  (anonymous function) @ jquery.autocomplete.min.js:195
  n.event.dispatch @ jquery.min.js:3
  r.handle @ jquery.min.js:3
  </code></pre>
  
  <p>Here is the method I call:</p>
  
  <pre><code>var url = $(item).data('url');
  var keyField = $(item).data('keyField') !== undefined ? $(item).data('keyField') : 'id';
  var valueField = $(item).data('valueField') !== undefined ? $(item).data('valueField') : 'description';
  
  $(myItem).devbridgeAutocomplete({
      serviceUrl: myUrl,
      minChars: 0,
      type: 'post',
      deferRequestBy: 500,
      transformResult: function (response) {
          var json_response = $.parseJSON(response);
  
          var suggestions = $.map(json_response.items, function (dataItem) {
                  var interface = $('.content-wrapper').interface();
  
                  return {value: dataItem[valueField], data: dataItem[keyField]};
              });
  
          return {suggestions: suggestions};
      },
      onSelect: function (suggestion) {
          // Do my stuff to populate the view
      }
  });
  </code></pre>
  
  <p>Looking at the source code, the problem raises when the function <code>onSelect()</code> is called because no suggestions are in the array.</p>
  
  <p>Why that array is empty? I'm selecting a filtered value so should have one element</p>