I have a form with several fieldsets and i am thinking about adding a vertical tabs form field to turn the current fieldset to vertical tabs but i use a lot of AJAX in the fieldsets. The AJAX elements need wrappers. I put the wrappers in the respective fieldsets for example:

$form['fieldset-general'] = [
    '#type' => 'fieldset',
    '#title' => t('<i class="glyphicon glyphicon-list-alt"></i>  General'),
    '#collapsible' => TRUE,
    '#prefix' => '<div id="general-fieldset-wrapper">',
    '#suffix' => ' </div>',

If i now add the vertical-tabs form field ...

$form['vertical-tabs-set'] = [
    '#type' => 'vertical_tabs',

... i have to disable the wrappers in my fieldsets for it to work:

$form['fieldset-general'] = [
    '#type' => 'fieldset',
    '#title' => t('General'),
    '#group' => 'vertical-tabs-set',

I've tried to add the wrapper to the vertical-tabs form field, or to new markup form fields but it didn't work.

Is here a way to make wrappers work in this case?

  • Hm a workaround should be to put all the fieldsets defined as a vertical tab into another fieldset where '#prefix' and '#suffix' should work. It's not very nice tho. – Xyarvius Apr 15 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.