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
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
Hi Carl, On Wed, 2011-02-16 at 11:14 -0700, Carl Wiedemann wrote:
You need to use the #weight parameter http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html...
Excellent! Came across that option in the documentation but it slipped my mind again. I'm sorta learning to swim in the deep end of the pool ;) so some of the details get overlooked/forgotten once in a while. Thanks for your quick response. Regards, Leonard. -- mount -t life -o ro /dev/dna /genetic/research
participants (2)
-
Carl Wiedemann -
Leonard den Ottolander.nl