MDL-61016 form: fix handling disabledIf + hideIf with same dependency
authorDavo Smith <davo.smith@synergy-learning.com>
Tue, 12 Dec 2017 14:52:32 +0000 (14:52 +0000)
committerDavo Smith <davo.smith@synergy-learning.com>
Tue, 12 Dec 2017 14:53:33 +0000 (14:53 +0000)
lib/formslib.php

index 77efbe9..3a3b602 100644 (file)
@@ -2492,9 +2492,13 @@ require(["core/event", "jquery"], function(Event, $) {
             }
         }
         foreach ($this->_hideifs as $dependenton => $conditions) {
-            $result[$dependenton] = array();
+            if (!isset($result[$dependenton])) {
+                $result[$dependenton] = array();
+            }
             foreach ($conditions as $condition => $values) {
-                $result[$dependenton][$condition] = array();
+                if (!isset($result[$dependenton][$condition])) {
+                    $result[$dependenton][$condition] = array();
+                }
                 foreach ($values as $value => $dependents) {
                     $result[$dependenton][$condition][$value][self::DEP_HIDE] = array();
                     foreach ($dependents as $dependent) {