Hiding fieldsets in a form using hook_form_alter()

The following examples shows how to hide fields/fieldsets in forms using hook_form_alter(). I suggest using the devel module to determine how to target your field(s) or fieldset(s). You can add a dpm($form) to the function during development and testing.

Note that this will prevent the value from being submitted. If you need the value to be included in the submission, you’re better off doing something like this:

Leave a Reply

Your email address will not be published.