]> _ Git - cubist_cms-back.git/commitdiff
wip #6251 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Sep 2023 08:05:47 +0000 (10:05 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 7 Sep 2023 08:05:47 +0000 (10:05 +0200)
src/resources/views/when.blade.php

index e437a47b2d0de4ad246c732d9bf7619c8bb2b80e..e741ed2915e3c600fe29fe17957a5344b20cc911 100644 (file)
@@ -34,7 +34,7 @@
                     var order = 1000;
                     $.each(when, function (property, conditions) {
                         var e = findCloserInput(element, property);
-                        if ($(element).is('[bp-field-name]') && $(element).attr('bp-field-name').indexOf('area_1') >= 0) {
+                        if ($(element).is('[bp-field-name]') && $(element).attr('bp-field-name').indexOf('logattempts') >= 0) {
                             console.log(property, element, e);
                         }
                         var val;
 
             function findCloserInput(element, inputName) {
 
-                let siblings = $(element).siblings('[data-name="' + inputName + '"]');
-                if (siblings.length === 0) {
+                let found;
+                if ($(element).is('form')) {
+                    found = $(element).find('[data-name="' + inputName + '"]').eq(0);
+                } else {
+                    found = $(element).siblings('[data-name="' + inputName + '"]');
+                }
+                if (found.length === 0) {
                     let parent = $(element).parent();
                     if (parent === null || $(parent).length === 0) {
                         return null;
                     }
                     return findCloserInput(parent, inputName);
                 }
-                let res = $(siblings).find('[name="' + inputName + '"]');
+                let res = $(found).find('[name="' + inputName + '"]');
                 if (res.length === 0) {
-                    res = $(siblings).find('[name$="___' + inputName + '"]');
+                    res = $(found).find('[name$="___' + inputName + '"]');
                 }
                 return res;
             }