From 94773a9dc1c3bb004e754d54d7d9fb04be74ea69 Mon Sep 17 00:00:00 2001 From: Pierre Date: Tue, 6 Jun 2017 19:05:49 +0200 Subject: [PATCH] Added a getResults method --- assets/js/components/userSelect/userSelect.js | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/assets/js/components/userSelect/userSelect.js b/assets/js/components/userSelect/userSelect.js index b89fab76..3cb98dcd 100644 --- a/assets/js/components/userSelect/userSelect.js +++ b/assets/js/components/userSelect/userSelect.js @@ -67,7 +67,6 @@ ComunicWeb.components.userSelect = { * @return {String} The formated informations */ formatUser: function(infos){ - console.log(infos); if(!infos.id) return infos.id; @@ -75,4 +74,30 @@ ComunicWeb.components.userSelect = { return $(" " + infos.text + ""); }, + /** + * Returns the results of a specified select element + * + * @param {HTMLElement} inputSelect The target element + * @return {Object} An object with all the select IDs + */ + getResults: function(inputSelect){ + + //Prepare return + var usersID = {}; + + for(i in inputSelect.children){ + + //Check it is really a children + if(inputSelect.children[i].value){ + //Get ID + var userID = inputSelect.children[i].value; + + usersID['user-'+userID] = userID; + } + } + + //Return result IDs + return usersID; + + } }; \ No newline at end of file