[development] Inserting fields into a form

Steve Edwards killshot91 at comcast.net
Mon Sep 7 03:06:12 UTC 2009


Change the weight for your module in the system table so it has a higher 
number than the Captcha module.  That way, yours will be the last one to 
run.

Steve

Jeff Greenberg wrote:
> Jerad Bitner wrote:
>
>> Look at '#weight'
>>
> Ok, I've changed my hook to include weights for all the fields I'm 
> adding, as well as adding weights to the existing fields.
>
> The problem I'm having is that when I dump the form at the time of my 
> hook, the captcha field doesn't exist yet as far as $form is 
> concerned, but somewhere between my hooking it and the form appearing, 
> the captcha field is present (the captcha module uses 
> hook_form_alter).  The problem is that the captcha module is putting 
> its field after the name field, which is right at the top of the form. 
> If I assign a weight to it in my hook (keeping in mind the ['captcha'] 
> field doesn't exist yet when I do that) the captcha doesn't show up at 
> all.
>
> Is there a way I can be the last one to modify the form, so that the 
> captcha field already exists and I can change its weight?
>


More information about the development mailing list