Skip to content

Beautiful Open-Source Form Builder

Fix a logic check bug if value not in form param (#70)

Chirag1d3541f785b6
diff --git a/app/Service/Forms/FormLogicConditionChecker.php b/app/Service/Forms/FormLogicConditionChecker.php
index 14ea0dc18..ba201047b 100644
--- a/app/Service/Forms/FormLogicConditionChecker.php
+++ b/app/Service/Forms/FormLogicConditionChecker.php
@@ -23,7 +23,7 @@ class FormLogicConditionChecker
// If it's not a group, just a single condition
if (!isset($conditions['operatorIdentifier'])) {
- return $this->propertyConditionMet($conditions['value'], $formData[$conditions['value']['property_meta']['id']]);
+ return $this->propertyConditionMet($conditions['value'], $formData[$conditions['value']['property_meta']['id']] ?? null);
}
if ($conditions['operatorIdentifier'] === 'and') {
@@ -102,7 +102,7 @@ class FormLogicConditionChecker
if(is_array($fieldValue)){
return count($fieldValue) === 0;
}
- return (!$fieldValue || $fieldValue !== '' || $fieldValue !== null);
+ return $fieldValue == '' || $fieldValue == null || !$fieldValue;
}
private function checkGreaterThan ($condition, $fieldValue): bool {