You need to use the #weight parameter http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html... On Wed, Feb 16, 2011 at 10:58 AM, Leonard den Ottolander.nl < drupal@den.ottolander.nl> wrote:
Hi,
I'm trying to create a form with a list of items that I get from a database table. The query elements are sorted reversely to compensate for the fact that element_children($form) that I call later in my theme function starts from the end of the array.
After creating the form array I call drupal_render($form). However it appears drupal_render() rearranges those form items before it calls my theme function. This results in a randomly ordered table that I create from the database elements using theme('table').
Working with Drupal 6.2. Since this is a development site all caching is currently disabled and I explicitly cleared cached data via admin/settings/performance as well after I removed table drag items that I temporarily added. I even disabled, uninstalled, then reinstalled the module and refilled the table the module uses.
Is there a way to avoid the reordering of (certain) form elements when calling drupal_render()? Or am I forced to do the ordering in my theme function?
Regards, Leonard.
-- mount -t life -o ro /dev/dna /genetic/research