MDL-53730 form: Autocomplete triggers change event on change only
This commit is contained in:
committed by
Andrew Nicols
parent
456b8a602c
commit
1eaba735f5
+1
-1
File diff suppressed because one or more lines are too long
@@ -109,15 +109,21 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
});
|
||||
}
|
||||
}).fail(notification.exception);
|
||||
// Because this function get's called after changing the selection, this is a good place
|
||||
// to trigger a change notification.
|
||||
if (typeof M.core_formchangechecker != 'undefined') {
|
||||
};
|
||||
|
||||
/**
|
||||
* Notify of a change in the selection.
|
||||
*
|
||||
* @param {jQuery} originalSelect The jQuery object matching the hidden select list.
|
||||
* @return {Void}
|
||||
*/
|
||||
var notifyChange = function(originalSelect) {
|
||||
if (typeof M.core_formchangechecker !== 'undefined') {
|
||||
M.core_formchangechecker.set_form_changed();
|
||||
}
|
||||
originalSelect.change();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Remove the given item from the list of selected things.
|
||||
*
|
||||
@@ -146,6 +152,8 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
}
|
||||
// Rerender the selection list.
|
||||
updateSelectionList(options, state, originalSelect);
|
||||
// Notifiy that the selection changed.
|
||||
notifyChange(originalSelect);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -402,7 +410,8 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
});
|
||||
|
||||
updateSelectionList(options, state, originalSelect);
|
||||
|
||||
// Notifiy that the selection changed.
|
||||
notifyChange(originalSelect);
|
||||
// Clear the input field.
|
||||
inputElement.val('');
|
||||
// Close the suggestions list.
|
||||
@@ -440,6 +449,8 @@ define(['jquery', 'core/log', 'core/str', 'core/templates', 'core/notification']
|
||||
});
|
||||
// Rerender the selection list.
|
||||
updateSelectionList(options, state, originalSelect);
|
||||
// Notifiy that the selection changed.
|
||||
notifyChange(originalSelect);
|
||||
// Clear the input element.
|
||||
inputElement.val('');
|
||||
// Close the list of suggestions.
|
||||
|
||||
Reference in New Issue
Block a user