Fix button disable bug
authorJeremy Tan <[email protected]>
Wed, 23 Oct 2013 14:42:57 +0000 (22:42 +0800)
committerJeremy Tan <[email protected]>
Wed, 23 Oct 2013 14:42:57 +0000 (22:42 +0800)
testing/MCTXWeb/public_html/control.html
testing/MCTXWeb/public_html/static/mctx.control.js

index 18769d2..4eb3314 100644 (file)
         $(document).ready(function () {
           $("form").submit(function () { //Prevent form submit globally
             return false;
         $(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();
           
           //Set the status updated
           $("#state-exp").setStatusUpdater();
                 &nbsp;
               </p>
               <p class="centre">
                 &nbsp;
               </p>
               <p class="centre">
-                
                 <input type="button" name="start_explode" value="Explode test">
                 <input type="button" name="start_strain" value="Strain test">                
               </p>
                 <input type="button" name="start_explode" value="Explode test">
                 <input type="button" name="start_strain" value="Strain test">                
               </p>
index d3b5348..f414a82 100644 (file)
@@ -153,7 +153,8 @@ $.fn.startExperiment = function (group, experiment, force, result) {
    data : data
  }).done(function (data) {
    if (!result.checkStatus(data)) {
    data : data
  }).done(function (data) {
    if (!result.checkStatus(data)) {
-     return;
+    $(group).removeAttr('disabled');
+    return;
    }
    
    //Select the can
    }
    
    //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)) {
     data : {name : "can_select", set : can_number}
    }).done(function (data) {
     if (!result.checkStatus(data)) {
+     $(group).removeAttr('disabled');
      return;
     }
     
      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)) {
       data : {name : "can_enable", set : 1}
     }).done(function (data) {
       if (!result.checkStatus(data)) {
+        $(group).removeAttr('disabled');
         return;
       }
       result.html("&nbsp;");
       toggleControls(true);
         return;
       }
       result.html("&nbsp;");
       toggleControls(true);
-    }).always(function () {
+    }).fail(function () {
       $(group).removeAttr('disabled');
     });
    }).fail(function () {
       $(group).removeAttr('disabled');
     });
    }).fail(function () {

UCC git Repository :: git.ucc.asn.au