-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FE logic: When the value of number field is used to trigger visibility, components are emptied when "Clear on hide" is checked #3964
FE logic: When the value of number field is used to trigger visibility, components are emptied when "Clear on hide" is checked #3964
Comments
This is the same problem as here: #2900 "conditional": {
"eq": "0",
"show": true,
"when": "number"
} (note |
So this can be worked around by editing the JSON? I'm trying to figure out of this needs backporting. And a patch would be in the form builder to cast the value of |
The casting logic should be done based on the component type, since the component type determines the data type, or am I misunderstanding something? The option labels are |
What I meant is: If you select a component of type <input type="number" ... > instead of a text field. So the type of the input would depend on the component selected for the condition. That way it would have the right type of value without casting. |
Ah right, that makes sense! Note however that it's Formik that takes care of casting the string values to numbers then, and this would need to apply to component types |
I thought a bit more about it: We can't really rely only on the type of the chosen component (if the component has However, this would break the logic check for the selectboxes. These have a value that is an object, but in the 'simple conditional' configuration you enter a string. Then, Formio does some special checks when evaluating the logic. For example, if the value is "conditional": {
"eq": "valueB",
"show": true,
"when": "selectboxesComponent"
} then formio does some special check to see if So more thinking needed 💭 |
…field The simple conditional input field now depends on the selected component
… specific input field
… specific input field
… specific input field
…input for checkboxes
[#3964] Fix old forms with simple conditionals
Product versie / Product version
2.4.3 - 2.6.0
Omschrijf het probleem / Describe the bug
When the value of number/currency field is used in FE logic and the component that is made visible has: "Clear on hide" checked, the values entered into this field will be removed at validation (check_logic)
if Getal = 0 show Tekstvlak
If a different logic is used on the same Number component like:
if not Getal hide Tekstvlak
This bug does not occur, so it seems to be specific to the value in the number field
Discussion:
We changed the formio-builder so that for new forms the conditional value is not saved as a string but as a number.
However, this will not fix existing forms that have a configuration where the conditional value is already a string. For fixing these forms there were 2 possibilities:
open-forms/src/openforms/formio/utils.py
Line 358 in 1d22bdc
Considerations:
Conclusion:
In addition:
The text was updated successfully, but these errors were encountered: