Remove value when form field is hidden

I have some dependent fields on my form, when for example a checkbox is selected, other field is hidden. The problem is when the field is hidden, it maintains its value.
Solution
In the end I solved it by setting manual default values. If it is boolean, it is set to false, if it is string it is set to empty string "", etc.
Was this page helpful?