From b0d644d5fed096312f8849cbbdaba67c7f93e508 Mon Sep 17 00:00:00 2001 From: Sonia Zorba <sonia.zorba@inaf.it> Date: Wed, 26 Jun 2019 11:47:06 +0200 Subject: [PATCH] Disabled join button if no user is selected --- js/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/index.js b/js/index.js index 800f74f..fca8341 100644 --- a/js/index.js +++ b/js/index.js @@ -23,6 +23,8 @@ for (var i = 0; i < users.length; i++) { $userSelector.append('<option value="' + i + '">' + users[i] + '</option>'); } + + updateJoinButtonStatus(); }); }; } @@ -71,6 +73,14 @@ $('.primary-identity-icon').tooltip(); } + /** + * Enable or disable the join button if there are selected users or not. + */ + function updateJoinButtonStatus() { + var selectedUserIndex = $('#user-selector-group select').val(); + $('#send-join-request-btn').prop("disabled", selectedUserIndex === null); + } + // When the document is loaded $(document).ready(function () { @@ -93,6 +103,8 @@ $('#info-message-alert').addClass('hide'); }); + $('#search-user-modal').on('shown.bs.modal', updateJoinButtonStatus); + loadTooltips(); }); -- GitLab