[development] Forms API

Gordon Messmer yinyang at eburg.com
Wed Mar 18 05:32:00 UTC 2009


Steve Ringwood wrote:
> I wonder if it's because you are missing a final call 
> drupal_render($form) in your theme function?

That's exactly it.  I really appreciate everyone who pointed that out. 
The example in the documentation does exactly that, I simply didn't 
understand its significance.  Thanks.

> Also a suggestion for simplifying your code, when you build the form 
> change the loop with invoices to
> 
>  while ($invoice = db_fetch_object($invoices)) {
>    $fieldname = 'invoice-' . $invoice->invoice;
>    $form['invoice'][$invoice->invoice] = array(
...
> $form['invoice']['#tree'] = TRUE;

I took your advice here, too.  It really only saved one line of string 
manipulation, since the theme still has to skip over elements that start 
with '#', but at least the submit() function is clearer.  Plus I 
understand the "#tree" thing a little better, which is good. :)



More information about the development mailing list