title: Why does the '#weight' property sometimes not have any effect in Drupal forms?
body: <p>I'm trying to create a node form for a custom type. I have organic groups and taxonomy both enabled, but want their elements to come out in a non-standard order. So I've implemented <code>hook_form_alter</code> and set the <code>#weight</code> property of the <code>og_nodeapi</code> subarray to -1000, but it still goes after taxonomy and menu. I even tried changing the subarray to a fieldset (to force it to actually be rendered), but no dice. I also tried setting </p>
  
  <pre><code>$form['taxonomy']['#weight'] = 1000 
  </code></pre>
  
  <p>(I have two vocabs so it's already being rendered as a fieldset) but that didn't work either.</p>
  
  <p>I set the weight of my module very high and confirmed in the system table that it is indeed the highest module on the site - so I'm all out of ideas. Any suggestions?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>While I'm not exactly sure how, I did manage to get the taxonomy fieldset to sink below everything else, but now I have a related problem that's hopefully more manageable to understand. Within the taxonomy fieldset, I have two items (a tags and a multi-select), and I wanted to add some instructions in hook_form_alter as follows:</p>
  
  <pre><code>$form['taxonomy']['instructions'] = array(
    '#value' =&gt; "These are the instructions",
    '#weight' =&gt; -1,
  );
  </code></pre>
  
  <p>You guessed it, this appears <em>after</em> the terms inserted by the taxonomy module. However, if I change this to a fieldset:</p>
  
  <pre><code>$form['taxonomy']['instructions'] = array(
    '#type' =&gt; 'fieldset', // &lt;-- here
    '#title' =&gt; 'Instructions',  // &lt;-- and here for good measure
    '#value' =&gt; "These are the instructions",
    '#weight' =&gt; -1,
  );
  </code></pre>
  
  <p>then it magically floats to the top as I'd intended. I also tried textarea (this also worked) and explicitly saying markup (this did not).</p>
  
  <p>So basically, changing the type from "markup" (the default IIRC) to "fieldset" has the effect of no longer ignoring its weight.</p>