MDL-57680 form autocomplete: let singleselects be cleared.
This was already working after ajax had refreshed the choices, it was just broken on first page load.
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1026,6 +1026,12 @@ function($, log, str, templates, notification, LoadingIcon) {
|
||||
uniqueId++;
|
||||
|
||||
options.multiple = originalSelect.attr('multiple');
|
||||
if (!options.multiple) {
|
||||
// If this is a single select then there is no way to de-select the current value -
|
||||
// unless we add a bogus blank option to be selected when nothing else is.
|
||||
// This matches similar code in updateAjax above.
|
||||
originalSelect.prepend('<option>');
|
||||
}
|
||||
|
||||
if (typeof closeSuggestionsOnSelect !== "undefined") {
|
||||
options.closeSuggestionsOnSelect = closeSuggestionsOnSelect;
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ class MoodleQuickForm_course extends MoodleQuickForm_autocomplete {
|
||||
$coursestofetch = array();
|
||||
|
||||
foreach ($values as $onevalue) {
|
||||
if ((!$this->optionExists($onevalue)) &&
|
||||
if ($onevalue && !$this->optionExists($onevalue) &&
|
||||
($onevalue !== '_qf__force_multiselect_submission')) {
|
||||
array_push($coursestofetch, $onevalue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user