clear_on_hide restores all fields within a group to their original state, whenever that group gets hidden.
You can check the intended behaviour here: https://conditional-fields-cf7.bdwm.be/form-tester/?test-form=clear_on_hide
Feel free to set up your own form in the form tester and let me know which behaviour you expect.
Hi Jules,
The issue occurs only for styled checkbox inputs. The usual way checkbox inputs are styled is through CSS. The checkbox input is hidden and replaced by icons via ::before or ::after pseudo elements.
It looks like the plugin’s “clear on hide” function does not look for checkbox inputs that are hidden by CSS and ends up being uncleared.
I suspect the issue is the same for styled radio buttons since it employs the same method of hiding the input control via CSS.
It depends how the checkboxes are styled. If they are styled using this logic for example, everything should work fine: https://bdwm.be/contact-form-7-toggle-buttons/
If the “styling” relies heavily on javascript, and are implemented without triggering the “change” of “input” event, then Conditional Fields has no way of knowing that the values have actually changed. Check: https://conditional-fields-cf7.bdwm.be/docs/troubleshooting/groups-are-not-updated-automatically-after-a-value-changes/
Thanks Jules. I changed the CSS for the radio and checkbox inputs to use opacity: 0; position: absolute; instead of display:none;
The clear_on_hide is working correctly now.