From 5106e0f55d86a97b8714bda63a8e275e62a0cc2a Mon Sep 17 00:00:00 2001 From: Jeremy Tan Date: Wed, 23 Oct 2013 22:42:57 +0800 Subject: [PATCH] Fix button disable bug --- testing/MCTXWeb/public_html/control.html | 8 ++++---- testing/MCTXWeb/public_html/static/mctx.control.js | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) 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 () { -- 2.20.1