rvr-nextgen/public/static/js/communities/community_members.js
Pőcze Bence 2f9b97d1a4
All checks were successful
rvr-nextgen/pipeline/pr-master This commit looks good
solve community member edit with forms
2023-04-23 15:55:31 +02:00

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);
});
})();