From f8ae0a97ef3307e19cde7cdcdedaaa24d210cb9d Mon Sep 17 00:00:00 2001 From: xamgore <xamgore@ya.ru> Date: Fri, 6 Mar 2015 09:37:50 +0300 Subject: [PATCH] FIX: locking the select subject menu, when faculty is chosen. If you choose any faculty at the menu, it is possible to catch drop down menu with subjects at the previous stage. Now that behaviour is fixed. Improves usability. --- ~dev_rating/media/js/discipline/general.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/~dev_rating/media/js/discipline/general.js b/~dev_rating/media/js/discipline/general.js index 589444dc9..aa0f23e35 100644 --- a/~dev_rating/media/js/discipline/general.js +++ b/~dev_rating/media/js/discipline/general.js @@ -15,8 +15,9 @@ $(function() { var optionVal = parseInt($("select.SelectFaculty").children("option:selected").val()); if (optionVal <= 0) return; - - var g_facultyID = optionVal; + + selectSubject.attr("disabled", true); + var g_facultyID = optionVal; $.post( g_URLdir + "handler/map/GetSubjectsList", { @@ -25,15 +26,18 @@ $(function() { function(data) { selectSubject.select2("val", ""); - selectSubject.attr("disabled", true); data = (data !== "") ? $.parseJSON(data) : {}; var jProto = $($.parseHTML("<option></option>")); selectSubject.html(""); - + $.each(data, function (key, cur) { jProto.html(cur.Title).val(cur.ID); selectSubject.append(jProto.clone()); - }); + }); + } + ).always( + function(success) + { selectSubject.removeAttr("disabled"); } ); -- GitLab