Alter Autocomplete's source before request

Created on 7 December 2015, over 8 years ago
Updated 3 July 2023, 12 months ago

Hi!

this module is awesome, because let's you deal with very complex situations, but there's no easy way to alter the source function parameters which are request and response.
For example, let's say you have an exposed filter with a select which filters the results of the autocomplete and the search at the same time.
With this patch you can implement an event, something like these:

$form = /* get the form element */
$form.on('searchautocompletesource', function (event, request, response) {
  var subhomeValue = $subhomeSelect.val();
  if (subhomeValue !== 'All') {
    request.subhome = subhomeValue;
  }
});

and with that we added a new parameter at the request callback of the autocomplete:
/search/autocomplete?term=quantum&subhome=physics


*In pair with @lucas.constantino

✨ Feature request
Status

Closed: outdated

Version

4.0

Component

Code

Created by

πŸ‡§πŸ‡·Brazil sebas5384

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