// Notifiy that the selection changed.
notifyChange(originalSelect);
- if (!options.multiple) {
+ if (options.closeSuggestionsOnSelect) {
// Clear the input element.
inputElement.val('');
// Close the list of suggestions.
* @param {Boolean} caseSensitive - If search has to be made case sensitive.
* @param {Boolean} showSuggestions - If suggestions should be shown
* @param {String} noSelectionString - Text to display when there is no selection
+ * @param {Boolean} closeSuggestionsOnSelect - Whether to close the suggestions immediately after making a selection.
* @return {Promise}
*/
- enhance: function(selector, tags, ajax, placeholder, caseSensitive, showSuggestions, noSelectionString) {
+ enhance: function(selector, tags, ajax, placeholder, caseSensitive, showSuggestions, noSelectionString,
+ closeSuggestionsOnSelect) {
// Set some default values.
var options = {
selector: selector,
};
options.multiple = originalSelect.attr('multiple');
+ if (typeof closeSuggestionsOnSelect !== "undefined") {
+ options.closeSuggestionsOnSelect = closeSuggestionsOnSelect;
+ } else {
+ // If not specified, this will close suggestions by default for single-select elements only.
+ options.closeSuggestionsOnSelect = !options.multiple;
+ }
+
var originalLabel = $('[for=' + state.selectId + ']');
// Create the new markup and insert it after the select.
var suggestions = [];
- get_enrolled_with_capabilities_join()
Setting this parameter to a non-zero value will add a condition to the query such that only users that were enrolled
with this enrolment method will be returned.
+* New optional parameter 'closeSuggestionsOnSelect' for the enhance() function for form-autocomplete. Setting this to true will
+ close the suggestions popup immediately after an option has been selected. If not specified, it defaults to true for single-select
+ elements and false for multiple-select elements.
=== 3.3.1 ===