Pőcze Bence
2f9b97d1a4
All checks were successful
rvr-nextgen/pipeline/pr-master This commit looks good
18 lines
650 B
JavaScript
18 lines
650 B
JavaScript
(function () {
|
|
const element = document.getElementById('newMember').elements['user_id'];
|
|
const choices = new Choices(element, {
|
|
noResultsText: 'No users found',
|
|
noChoicesText: 'Start typing to search users'
|
|
});
|
|
|
|
element.addEventListener('search', RVR.debounce(async function (e) {
|
|
RVR.httpRequest('GET', searchUserUrl.replace('QUERY', encodeURIComponent(e.detail.value)), function () {
|
|
choices.setChoices(this.response.results, 'value', 'label', true);
|
|
});
|
|
}));
|
|
|
|
element.addEventListener('choice', function () {
|
|
choices.setChoices([], 'value', 'label', true);
|
|
});
|
|
})();
|