From dd900eb59d5cbec32d0d919c7d9e99ceabdd6baa Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 7 Jun 2017 16:38:06 +0200 Subject: [PATCH] More reliable way to get usersID --- assets/js/components/userSelect/userSelect.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/assets/js/components/userSelect/userSelect.js b/assets/js/components/userSelect/userSelect.js index a9c3dda3..ab835e02 100644 --- a/assets/js/components/userSelect/userSelect.js +++ b/assets/js/components/userSelect/userSelect.js @@ -82,15 +82,18 @@ ComunicWeb.components.userSelect = { */ getResults: function(inputSelect){ + //Get entries + var selectUsersResult = $(inputSelect).select2("data"); + //Prepare return var usersID = []; - for(i in inputSelect.children){ + for(i in selectUsersResult){ //Check it is really a children - if(inputSelect.children[i].value){ + if(selectUsersResult[i].id){ //Add ID to the table - usersID.push(inputSelect.children[i].value); + usersID.push(selectUsersResult[i].id); } }