[support] HowTo: table within a fieldset

Stefan Borchert stefan at borchert.cc
Thu Oct 26 08:05:02 UTC 2006


Jason Flatt schrieb:
> On Wednesday 25 October 2006 14:01, Stefan Borchert wrote:
>   
>> Hi.
>> After posting by accident to the themes-list, I try it here:
>>
>> For a module settings page I would like to build up a table of
>> available extensions (don't care about, just think of a simple table)
>> but this table should be within a fieldset (collapsible).
>>     
> [ s n i p ]
>   
>> Other form elements above and below of this fieldset (for
>> example the submit button) are displayed correctly but I can't put the
>> table into the fieldset. How do I handle this?
>> I can build the table and can build the fieldset but the table doesn't
>> want to appear within the fieldset.
>>
>> Any ideas (or a handbook page) or is this simply impossible?
>>     
> I'm assuming I know what you're talking about, so if I fail to answer your 
> question, please try again and rephrase it.  (Or wait for someone with a clue 
> to answer.)
>
> You could try using both the markup type and the #prefix & #suffix properties 
> to accomplish this.
>
> Something like this untested, modified snippet you posted:
>
>   $form['ext'] = array('#type' => 'fieldset',
>       '#collapsible' => true,
>       '#collapsed' => true,
>       '#tree' => true,
>       '#title' => t('Extensions'));
>
>   // build extension table
>   foreach ($extensions as $key => $extension) {
>     $form['ext'][$key]['status'] = array('#type' => 'checkbox',
>       '#default_value' => $extension['status'],
>       '#prefix' => '<tr><td>',
>       '#suffix' => '</td>');
>     $form['ext'][$key]['weight'] = array('#type' => 'weight',
>       '#default_value' => $extension['weight'],
>       '#prefix' => '<td>',
>       '#suffix' => '</td>');
>     $form['ext'][$key]['title'] = array('#value' => $extension['title'],
>       '#prefix' => '<td>',
>       '#suffix' => '</td></tr>');
>   }
>
> You'll have to play around with the markup type to get your table tags in 
> there the way you want them.
>   
Ah. I've never thought to use this both markups for building the table.
Thank you. I'll try this.

 Stefan


More information about the support mailing list