I have a form containing a checkbox and a \"value field\". The value field could be anything, a text box, a compound field, a collection - anything.
The form could l
Just remove the child fields prior to validation if the parent's checkbox is set to false.
Read more in the cookbook article How to Dynamically Modify Forms Using Form Events.
Subscribe to form events FormEvents::POST_SET_DATA
and remove the field in your subscriber.
The section Adding an Event Subscriber to a Fom class covers this topic.
You can aswell introduce different validation groups for your form.
Just apply another validation group ( not containing the chield fields ) if the parent's checkbox is set to false.