I am implementing jQuery UI Autocomplete and am wondering if there is any way to only allow a selection from the suggested results that are
I'm on drupal 7.38 and to only allow input from select-box in autocomplete you only need to delete the user-input at the point, where js does not need it any more - which is the case, as soon as the search-results arrive in the suggestion-popup right there you can savely set:
**this.input.value = ''**
see below in the extract from autocomplete.js ... So I copied the whole Drupal.jsAC.prototype.found object into my custom module and added it to the desired form with
$form['#attached']['js'][] = array(
'type' => 'file',
'data' => 'sites/all/modules/_autocomplete.js',
);
And here's the extract from drupal's original misc/autocomplete.js modified by that single line...
Drupal.jsAC.prototype.found = function (matches) {
// If no value in the textfield, do not show the popup.
if (!this.input.value.length) {
return false;
}
// === just added one single line below ===
this.input.value = '';
// Prepare matches.
=cut. . . . . .