title: How to use onclick event with drupal fieldset?
body: <p>In drupal i have generated a list where each item is a fieldset with collapsible, that can contain extra information.</p>
  
  <p>Because of the rather large list i want to avoid loading the extra information until a user clicks on the fieldset.</p>
  
  <p>Best case scenario:</p>
  
  <ul>
  <li>User clicks on collapsed fieldset.</li>
  <li>Fieldset loads extra information.</li>
  <li>Fieldset uncollapses.</li>
  </ul>
  
  <p>Thx in advance.</p>
  
  <p>EDIT:</p>
  
  <p>This is part of my current code:</p>
  
  <pre><code>$form[$service["name"]] = array(
      '#type' =&gt; 'fieldset',
      '#title' =&gt; t($titleBuilder),
      '#collapsible' =&gt; TRUE,
      '#collapsed' =&gt; TRUE,
      '#tree' =&gt; TRUE,
  );
  </code></pre>
  
  <p>I think you should be able to add the line:</p>
  
  <pre><code>    '#onclick' =&gt; "testCapa()",
  </code></pre>
  
  <p>but this doesn't work, and browser loads a blank page.</p>
  
  <p>EDIT2:
  Tried this:</p>
  
  <pre><code>    '#attributes' =&gt; array("onclick" =&gt; "testCapa()"),
  </code></pre>
  
  <p>instead of loading a blank page, my block get's loaded now. But testCapa() doesn't get called when i click the fieldset.</p>