By glennnz on
Hi
I am altering my user_register form.
I am using Profile and Simplenews modules, and I want to remove the fieldsets around the Profile and Simplenews fields, but keep the fields themselves.
This will just make my form smaller and simpler.
How can I remove the fieldsets?
I've tried:
$form['fieldset']['#type'] = 'hidden';
and
$form['fieldset'] = NULL;
but both of these hide the fields as well.
Any ideas?
Thanks
Glenn
Comments
You would need to move the
You would need to move the elements of the fieldset up a level before hiding/removing the fieldset.
Or you may be able to do it
Or you may be able to do it by changing the #type to 'markup'.
Contact me to contract me for D7 -> D10/11 migrations.
how about : foreach
how about :
Bump
Although this thread is pretty old and i'm bumping it, i believe the best way to achieve this is to put this:
$form['{fieldset_name}']['#access']=false;in your implementation of hook_form_alter, of course replacing
{fieldset_name}with your fieldset's name (the key in the$formarray)Works
Thanks this works so clean
Remove the fields from the
Remove the fields from the fieldset with:
unset($form['#group_children']['field_your_field']);Then remove the field group with: