From: Jeremy Tan Date: Wed, 23 Oct 2013 14:42:57 +0000 (+0800) Subject: Fix button disable bug X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=5106e0f55d86a97b8714bda63a8e275e62a0cc2a;p=matches%2FMCTX3420.git Fix button disable bug --- diff --git a/testing/MCTXWeb/public_html/control.html b/testing/MCTXWeb/public_html/control.html index 18769d2..4eb3314 100644 --- a/testing/MCTXWeb/public_html/control.html +++ b/testing/MCTXWeb/public_html/control.html @@ -18,9 +18,10 @@ $(document).ready(function () { $("form").submit(function () { //Prevent form submit globally return false; - }).each(function () { - this.reset(); - }); + }).trigger("reset"); //Reset forms + + //Force enable start buttons if previously disabled + $("#start-controls input[type='button']").removeAttr("disabled"); //Set the status updated $("#state-exp").setStatusUpdater(); @@ -181,7 +182,6 @@  

-

diff --git a/testing/MCTXWeb/public_html/static/mctx.control.js b/testing/MCTXWeb/public_html/static/mctx.control.js index d3b5348..f414a82 100644 --- a/testing/MCTXWeb/public_html/static/mctx.control.js +++ b/testing/MCTXWeb/public_html/static/mctx.control.js @@ -153,7 +153,8 @@ $.fn.startExperiment = function (group, experiment, force, result) { data : data }).done(function (data) { if (!result.checkStatus(data)) { - return; + $(group).removeAttr('disabled'); + return; } //Select the can @@ -162,6 +163,7 @@ $.fn.startExperiment = function (group, experiment, force, result) { data : {name : "can_select", set : can_number} }).done(function (data) { if (!result.checkStatus(data)) { + $(group).removeAttr('disabled'); return; } @@ -171,11 +173,12 @@ $.fn.startExperiment = function (group, experiment, force, result) { data : {name : "can_enable", set : 1} }).done(function (data) { if (!result.checkStatus(data)) { + $(group).removeAttr('disabled'); return; } result.html(" "); toggleControls(true); - }).always(function () { + }).fail(function () { $(group).removeAttr('disabled'); }); }).fail(function () {