diff --git a/src/@optimizely/forms-sdk/src/form-depend-conditions/formDependConditions.ts b/src/@optimizely/forms-sdk/src/form-depend-conditions/formDependConditions.ts index 401041c..f5192be 100644 --- a/src/@optimizely/forms-sdk/src/form-depend-conditions/formDependConditions.ts +++ b/src/@optimizely/forms-sdk/src/form-depend-conditions/formDependConditions.ts @@ -24,16 +24,14 @@ export class FormDependConditions { for (let i = 0; i < conditionProps.conditions.length; i++) { const condition = conditionProps.conditions[i] const fieldValue = formSubmissions.filter(s => equals(s.elementKey, condition.field))[0]?.value as string - if (!isNull(fieldValue)) { - const conditionFunction = ConditionFunctions[condition.operator]; - if (!isNull(conditionFunction)){ - var checkResult = conditionFunction(fieldValue, condition.fieldValue) - if (conditionProps.conditionCombination === ConditionCombinationType.Any && checkResult) { - return true - } - if (conditionProps.conditionCombination !== ConditionCombinationType.Any && !checkResult) { - return false - } + const conditionFunction = ConditionFunctions[condition.operator]; + if (!isNull(conditionFunction)){ + let checkResult = conditionFunction(fieldValue, condition.fieldValue) + if (conditionProps.conditionCombination === ConditionCombinationType.Any && checkResult) { + return true + } + if (conditionProps.conditionCombination !== ConditionCombinationType.Any && !checkResult) { + return false } } }