open-forms
open-forms copied to clipboard
Logic triggers with boolean variables don't work correctly
Product versie / Product version
latest (fdb19fdd6625e0281bdaed4a39a90f4f9150ec26)
Omschrijf het probleem / Describe the bug
When I use a simple logic rule and use a boolean variable (checkbox component, boolean user defined variable...) as a trigger, this rule is not correctly serialized to JSON.
The resulting expression is:
{
"==": [
{
"var": "kanAfvalOphalen"
},
"true"
]
}
and it should be:
{
"==": [
{
"var": "kanAfvalOphalen"
},
true
]
}
UI representation:
The workaround is to use advanced logic instead of simple logic.
Stappen om te reproduceren / Steps to reproduce
- Add user defined variable
foo
with data type boolean - Add a simple logic rule
- Select the variable
foo
in the "Als" dropdown - Select de operation "is gelijk aan"
- Select "de waarde"
- Select the comparison value "Ja"
- Now, click the cog icon and click "Toon/verberg DSL weergave"
Any actions associated with this rule don't execute (for both true/false cases) because a string will never be equal to a boolean.
Verwacht gedrag / Expected behavior
Selecting Yes/No in the dropdown configures an actual boolean in the JSON logic expression, and my actions execute properly.
Screen resolution
None
Device
None
OS
None
Browser
Chrome