[development] drupal_render() reordering form items

Carl Wiedemann carl.wiedemann at gmail.com
Wed Feb 16 18:14:10 UTC 2011


You need to use the #weight parameter
http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#weightval


On Wed, Feb 16, 2011 at 10:58 AM, Leonard den Ottolander.nl <
drupal at 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110216/81d1fc5e/attachment.html 


More information about the development mailing list