Merge branch 'MDL-30660' of git://github.com/timhunt/moodle
authorSam Hemelryk <sam@moodle.com>
Thu, 8 Dec 2011 22:43:41 +0000 (11:43 +1300)
committerSam Hemelryk <sam@moodle.com>
Thu, 8 Dec 2011 22:46:09 +0000 (11:46 +1300)
1  2 
lib/javascript-static.js

@@@ -263,15 -263,28 +263,28 @@@ M.util.show_confirm_dialog = function(e
  
              if (target.test('a')) {
                  window.location = target.get('href');
              } else if ((targetancestor = target.ancestor('a')) !== null) {
                  window.location = targetancestor.get('href');
              } else if (target.test('input')) {
                  targetform = target.ancestor('form');
-                 if (targetform && targetform.submit) {
-                     targetform.submit();
+                 if (!targetform) {
+                     return;
+                 }
+                 if (target.get('name') && target.get('value')) {
+                     targetform.append('<input type="hidden" name="' + target.get('name') +
+                                     '" value="' + target.get('value') + '">');
                  }
+                 targetform.submit();
+             } else if (target.get('tagName').toLowerCase() == 'form') {
+                 // We cannot use target.test('form') on the previous line because of
+                 // http://yuilibrary.com/projects/yui3/ticket/2531561
+                 target.submit();
              } else if (M.cfg.developerdebug) {
--                alert("Element of type " + target.get('tagName') + " is not supported by the M.util.show_confirm_dialog function. Use A or INPUT");
++                alert("Element of type " + target.get('tagName') + " is not supported by the M.util.show_confirm_dialog function. Use A, INPUT, or FORM");
              }
          };