From: Vincent Vanwaelscappel Date: Thu, 7 Sep 2023 08:05:47 +0000 (+0200) Subject: wip #6251 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8b43e1063d420fa27b030c3c2cd9126439e41f9f;p=cubist_cms-back.git wip #6251 @0.25 --- diff --git a/src/resources/views/when.blade.php b/src/resources/views/when.blade.php index e437a47..e741ed2 100644 --- a/src/resources/views/when.blade.php +++ b/src/resources/views/when.blade.php @@ -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; @@ -138,17 +138,22 @@ 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; }