Fixes issue with unchecked checkboxes during package installation
authorMatthias Schmidt <gravatronics@live.com>
Sun, 28 Jul 2013 21:44:23 +0000 (23:44 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 28 Jul 2013 21:44:23 +0000 (23:44 +0200)
If one checkbox is unchecked, no further input element is evaluated since `return false;` is executed which terminates the iteration instead of (as intended) continuing the iteration with the next input element.

wcfsetup/install/files/acp/js/WCF.ACP.js

index 6b5f9082265a5dbfce0a965a024f3593935d398a..c2c503ccb971edde73e591d70ebea6802982aa4e 100644 (file)
@@ -612,34 +612,32 @@ WCF.ACP.Package.Installation = Class.extend({
                        var $inputElement = $(inputElement);
                        var $type = $inputElement.attr('type');
                        
-                       if (($type == 'checkbox' || $type == 'radio') && !$inputElement.prop('checked')) {
-                               return false;
-                       }
-                       
-                       var $name = $inputElement.attr('name');
-                       if ($name.match(/(.*)\[([^[]*)\]$/)) {
-                               $name = RegExp.$1;
-                               $key = RegExp.$2;
-                               
-                               if ($additionalData[$name] === undefined) {
+                       if (($type != 'checkbox' && $type != 'radio') || $inputElement.prop('checked')) {
+                               var $name = $inputElement.attr('name');
+                               if ($name.match(/(.*)\[([^[]*)\]$/)) {
+                                       $name = RegExp.$1;
+                                       $key = RegExp.$2;
+                                       
+                                       if ($additionalData[$name] === undefined) {
+                                               if ($key) {
+                                                       $additionalData[$name] = { };
+                                               }
+                                               else {
+                                                       $additionalData[$name] = [ ];
+                                               }
+                                       }
+                                       
                                        if ($key) {
-                                               $additionalData[$name] = { };
+                                               $additionalData[$name][$key] = $inputElement.val();
                                        }
                                        else {
-                                               $additionalData[$name] = [ ];
+                                               $additionalData[$name].push($inputElement.val());
                                        }
                                }
-                               
-                               if ($key) {
-                                       $additionalData[$name][$key] = $inputElement.val();
-                               }
                                else {
-                                       $additionalData[$name].push($inputElement.val());
+                                       $additionalData[$name] = $inputElement.val();
                                }
                        }
-                       else {
-                               $additionalData[$name] = $inputElement.val();
-                       }
                });
                
                this._executeStep(data.step, data.node, $additionalData);