viewsreference.js The function expects 1 argument, but 2 were provided.

Created on 20 June 2022, about 2 years ago
Updated 20 March 2023, over 1 year ago

Problem/Motivation

The function expects 1 argument, but 2 were provided.
```
File: viewsreference/js/viewsreference.js:
(function ($) {

"use strict";

/**
* Handles an autocompleteselect event.
*
* Override the autocomplete method to add a custom event.
*
* @param {jQuery.Event} event
* The event triggered.
* @param {object} ui
* The jQuery UI settings object.
*
* @return {bool}
* Returns false to indicate the event status.
*/
Drupal.autocomplete.options.select = function selectHandler(event, ui) {
var terms = Drupal.autocomplete.splitValues(event.target.value);
// Remove the current input.
terms.pop();
// Add the selected item.
if (ui.item.value.search(',') > 0) {
terms.push('"' + ui.item.value + '"');
}
else {
terms.push(ui.item.value);
}
event.target.value = terms.join(', ');
// Fire custom event that other controllers can listen to.
jQuery(event.target).trigger('viewsreference-select');
// Return false to tell jQuery UI that we've filled in the value already.
return false;
}

Drupal.behaviors.displayMessage = {
attach: function (context, settings) {
$(document).ajaxComplete(function (event, request, settings) {
$('.field--type-viewsreference select.viewsreference-display-id', context).each(function () {
$('.viewsreference-display-error', context).remove();
var $parent = $(this).parent().hide();
if ($(this).find('option').length <= 1) {
var $error = $('

There is no display available. Please select another view or change the field settings.

');
$parent.after($error);
}
else {
$parent.show();
}
});
});
}
};

})(jQuery, drupalSettings);
```

Proposed resolution

```
})(jQuery);
```

🐛 Bug report
Status

Fixed

Version

1.8

Component

Code

Created by

🇩🇪Germany fnalb2

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024