I've built an Open Atrium feature, and have been adding some tweaks to the .module. This includes a custom block that I'd like to have include some collapsed fieldsets. Normally, this would work:

<script type="text/javascript" src="/misc/collapse.js"></script>
<fieldset class="collapsible collapsed">
<legend>legend</legend>
<p>text in a collapsible fieldset that should be collapsed by default</p>
</fieldset>

However, it doesn't in the Ginkgo theme. The fieldset is indeed collapsible, but not collapsed initially. Oddly, when the legend is clicked, it appears to expand, as if it thought it was collapsed.

I'd very much appreciate some guidance as to how to implement a collapsed fieldset.

Comments

ergonlogic’s picture

Sorry, that first line should have read: drupal_add_js('misc/collapse.js);

ergonlogic’s picture

Title: How to implement a collapsed fieldset » Collapsed fieldsets don't work
Category: support » bug

After further reflection, I'm converting this to a bug report. IMHO, something as (usually) straight-forward as a collapsed fieldset shouldn't require a custom implementation to work under a particular theme. Please correct me if I'm wrong.

kobnim’s picture

Status: Closed (fixed) » Active

I was experiencing a similar problem. I wanted to create a collapsible fieldset from within a custom node-form.tpl.php.

I struggled for a while, but it is now working. Here is the code I am using:

<fieldset class="fieldset titled collapsible collapsed">
  <legend><span class="fieldset-title"><span class="icon"></span><a href="<script>document.write(window.location.pathname+'#fieldset');
</script>" class="active">My Fieldset Title</a></span></legend>
  <div class="fieldset-content">
    <!-- put fieldset content here -->
  </div> <!-- fieldset-content -->
</fieldset>

Hope that helps,
Mindy

UPDATE:
Note to myself, and anyone who may be having a similar problem:
If not using tao.js, you may need to add this javascript: drupal_add_js('/misc/collapse.js')

ANOTHER UPDATE:
It looks like a bug in collapse.js. See http://drupal.org/node/209420#comment-4972454

ergonlogic’s picture

Status: Active » Fixed

Thank you, Mindy. That worked like a charm!

Jeff Burnz’s picture

I have not seen this problem, I am using the same code from Tao in another custom theme and building fieldsets with FAPI and no issues.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

I'm seeing this when trying to use collapsed fieldgroups in cck. Interested in possible solutions. Thanks!

Anonymous’s picture

I should have added that this is happening in Open Atrium. Perhaps the issue should be filed with the gingko subtheme?

haydeniv’s picture

Project: Tao » Ginkgo
Version: 6.x-3.2 » 6.x-1.1
Issue summary: View changes

Moving to correct queue.