Fix all buttons performing the "complete" action
authorFlorian Zeitz <florob@babelmonkeys.de>
Thu, 2 Aug 2012 18:29:58 +0000 (20:29 +0200)
committerFlorian Zeitz <florob@babelmonkeys.de>
Thu, 2 Aug 2012 18:34:22 +0000 (20:34 +0200)
js/adhoc.js

index a4e157426e902b90590e7aee04868e9a1747acc7..cbe27523ab1ab905719fa82ca2fdce232d15c503 100644 (file)
@@ -169,9 +169,12 @@ Adhoc.prototype = {
         if (status === "executing") {
            var controls = $("<div class='actions'/>");
             for (kind in kinds) {
-               var input = $("<input type='button' disabled='disabled' class='btn' value='" + kinds[kind] + "'/>").click(function() {
-                   self.executeCommand(kind, (kind != 'prev') && self.serializeToDataform('form'), function(e) { self.displayResult(e) });
-               }).appendTo(controls);
+               var input;
+               (function (type) {
+                   input = $("<input type='button' disabled='disabled' class='btn' value='" + kinds[type] + "'/>").click(function() {
+                       self.executeCommand(type, (type != 'prev') && self.serializeToDataform('form'), function(e) { self.displayResult(e) });
+                   }).appendTo(controls);
+               })(kind);
                 if (actions.find(kind).length > 0)
                     input.removeAttr("disabled");
                if (actions.attr("execute") == kind)