[support] inserting fields into the login form in the correct order

Michael Anderson usufruct at gmail.com
Sat Feb 21 18:12:19 UTC 2009


Hello everyone,

I'm trying to add a few fields to the Drupal login form. Using
hook_form_alter I was able to change the login form to display a new field,
but the new field appears at the bottom of the form. Here is the code I used
to change the form:

    $form[newfield] = Array
        (
            '#type' => 'textfield',
            '#title' => 'newfield_title',
            '#maxlength' => 60,
            '#size' => 15,
            '#required' => 1,
        );

I get my new textfield, but I would like to place it after (below) the
password field.

It is not apparent to me how the default layout is generated. When I examine
the $form variable I don't see anything that would indicate an ordering of
elements. Is this something that has to be done via .tpl file in theme? I
would rather avoid that because then the login form becomes disordered again
if I change themes. Please advise.

-- 
La perfection est atteinte non quand il ne reste rien à ajouter, mais quand
il ne reste rien à enlever.
— Antoine de Saint-Exupéry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20090221/650ed81d/attachment.htm 


More information about the support mailing list