[support] fieldsets are not rendered collapsible if #title is '0' or 0 because of missing fieldset-legend in html source.

Marco Lechner - in medias res lechner at webgis.de
Tue Aug 16 14:16:29 UTC 2011


Hi,

if a fieldset shall be collapsible and has '#title' => 0 or '#title' =>
'0' in form_function the resulting html is missing "fieldset-legend" and
therefore the fieldset is not copllapsible. The Legend of the fieldset
("0") is not rendered either, of course. If collapsed => TRUE is set in
addition this part of the form is not accesible!

Can anybody reproduce this? I guess this is a major bug, isn't it?

Marco

example:

|<?php
   
    //fieldsets are missing fieldset-legend (and therefore are not
collapsible) if title is 0 or '0'.
   
    function test_menu() {
        $items = array();
        $items['test'] = array(
            'title' => 'test',
            'page callback' => 'drupal_get_form',
            'page arguments' => array('test_form'),
            'type' => MENU_NORMAL_ITEM,
        );
        return $items;
    }
   
    function test_form($form, &$form_state) {
        $form['nuller'] = array(
            '0' => array(
                '#type' => 'fieldset',
                '#title' => t(1),
                '#collapsible' => TRUE,
                '#collapsed' => FALSE,
                '#tree' => FALSE,
                'symbol' => array(
                    'symboltitle' => array(
                        '#type' => 'textfield',
                        '#title' => t('Title'),
                    ),
                ),
            ),
            '1' => array(
                '#type' => 'fieldset',
                '#title' => t('0'),
                '#collapsible' => TRUE,
                '#collapsed' => FALSE,
                '#tree' => FALSE,
                'symbol' => array(
                    'symboltitle' => array(
                        '#type' => 'textfield',
                        '#title' => t('Title'),
                    ),
                ),
            ),
            '2' => array(
                '#type' => 'fieldset',
                '#title' => t(0),
                '#collapsible' => TRUE,
                '#collapsed' => FALSE,
                '#tree' => FALSE,
                'symbol' => array(
                    'symboltitle' => array(
                        '#type' => 'textfield',
                        '#title' => t('Title'),
                    ),
                ),
            ),
        );
        return $form;
    }|

Resulting Html:

|...
<form accept-charset="UTF-8" id="test-form" method="post" action="/test">
<div>

    <fieldset id="edit-0" class="collapsible form-wrapper
collapse-processed">
        <legend>
            <span class="fieldset-legend">
        <a href="#" class="fieldset-title"><span
class="fieldset-legend-prefix element-invisible">Hide</span> 1</a>
        <span class="summary"></span>
            </span>
        </legend>
        <div class="fieldset-wrapper" style="display: block;">
            <div class="form-item form-type-textfield form-item-title">
                <label for="edit-title">Title </label>
                <input type="text" class="form-text" maxlength="128"
size="60" value="" name="title" id="edit-title">
            </div>
        </div>
    </fieldset>

    <fieldset id="edit-1" class="collapsible form-wrapper
collapse-processed">
        <div class="fieldset-wrapper">
    <div class="form-item form-type-textfield form-item-title">
                <label for="edit-title--2">Title </label>
        <input type="text" class="form-text" maxlength="128" size="60"
value="" name="title" id="edit-title--2">
            </div>
        </div>
    </fieldset>

    <fieldset id="edit-2" class="collapsible form-wrapper
collapse-processed">
        <div class="fieldset-wrapper">
            <div class="form-item form-type-textfield form-item-title">
                <label for="edit-title--3">Title </label>
                <input type="text" class="form-text" maxlength="128"
size="60" value="" name="title" id="edit-title--3">
            </div>
        </div>
    </fieldset>

    <input type="hidden"
value="form-luu9B2ykfiJAQ32TMd01m35ZpjIfj5zsFHaUzxSFQJw"
name="form_build_id">
    <input type="hidden"
value="s6tyq5bF6xiMhj4VIXxX9DEspCf8tC7cyMJEEQ8Cpo8" name="form_token">
    <input type="hidden" value="test_form" name="form_id">
</div>
</form>
  ...|


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20110816/d94aa91b/attachment.html 


More information about the support mailing list