We are experiencing a conditional logic problem and I have attached the exported test form which demonstrates the problem.
There is a field test_other which should be hidden if the value in the field type is not "a" and not "b". This is working in 3 out of 4 cases:
- If type is empty, test_other is is visible: ok
- If type is "a", test_other is is hidden: ok
- If type is "b", test_other is is visible: NOT ok
- If type is something else, test_other is is visible: ok
Now, if you look at the source you notice that there is a string "null" in the states definition of test_other. This might be related and what's strange is that we have no way of getting rid of this extra data in the source. Not even when editing the exported yaml file and importing it again. Drupal recognizes that the config has changed but when importing it, the "null" is still there.
For further testing, the form contains another field test_jh which achieves the same logic, but the other way round: here the logic says that the field is INvisible when type is either "a" or "b".
With this second example, the logic works as expected and we don't have the problem with the "null" string in the source. I know this is a crazy example and it only exists to reproduce the problem. So don't worry, the site builder is still in shape ;-)
Comment | File | Size | Author |
---|---|---|---|
#5 | 2944736-5.patch | 610 bytes | jrockowitz |
| |||
webform.webform.conditional_logic_and_example.yml | 3.92 KB | jurgenhaas |
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@jurgenhaas Edge case examples are always helpful. I tend to let a few example build up in the queue and then see if there are any patterns that can be easily or not easily addressed. Thanks.
Comment #3
gneef CreditAttribution: gneef at Tojio // Digital Agency commented@jrockowitz Are you planing any updates on this issue?
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedNo. I am busy dealing with other issues. Any help is welcomed.
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedFor combine conditions on the same element I recommend using a pattern.
The attached patch fixes an issue with the !pattern not executing.
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI think the example is also running into #2908379: Not saving all the states for the container element
Comment #8
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch that fixes the pattern issue but I am marking this as a duplicate issue.