[support] [Fwd: Re: hook_form_alter() data changed in array but not on screen]

Steve Edwards killshot91 at comcast.net
Mon Jun 22 18:16:31 UTC 2009


Now I'm running into this problem on a different site.  My module where 
hook_form_alter() has a weight of 999, so there should be nothing 
overriding it in the system table.  In this case I'm just trying to 
modify the value of the #weight property for the form buttons.  If I 
display the values in $form using dsm() after making the changes, the 
changed values are there, but they are not rendered on the screen.  Any 
other ideas?  I'm starting to pull out what's left of my hair.

Thanks.

Steve

-------- Original Message --------
Subject: 	Re: [support] hook_form_alter() data changed in array but not 
on screen
Date: 	Wed, 17 Jun 2009 12:20:24 -0700
From: 	Steve Edwards <killshot91 at comcast.net>
To: 	support at drupal.org
References: 	<4A387EB5.4040203 at comcast.net> 
<4A38D820.7010903 at earthlink.net> <4A3926D5.1020905 at comcast.net> 
<4A392961.7040904 at funnymonkey.com>



I had actually already done this.  I'm using uc_node_checkout, and the 
module weight for it in the system table is 100, so I set mine to 999.  
Mine is the highest weight in the table.

Steve

Marc Poris wrote:
> Some other module is probably having its hook_form_alter() come after 
> yours.  Try setting your module's weight greater than all other 
> modules and/or rename your module so it comes later alphabetically.
>
>
> Steve Edwards wrote:
>> Thanks for the suggestion.  Yes, it is &$form.  As I stated below, 
>> I'm already modifying other forms in the same function, and they are 
>> working fine.
>>
>> Steve
>>
>> Jamie Holly wrote:
>>> Are you sure you have &$form and not just $form in your function 
>>> declaration? I've had the same problem before and pulled my hair out 
>>> just to realize I forgot the &.
>>>
>>> Jamie Holly
>>>
>>>
>>>
>>>
>>> Steve Edwards wrote:
>>>> I'm trying to use hook_form_alter() to write data to a text field 
>>>> when the form is first displayed, but for some reason I can't get 
>>>> the values to display on the form itself.  I know I have the right 
>>>> form_id, because dsm() displays all the data for that form.  What's 
>>>> even weirder is that I can see the data being changed in the form 
>>>> itself, but it just won't change on the screen.  I can also change 
>>>> the weight of the field ($form['field_class_name']['#weight']=99;)
>>>> and it relocates the position of the field on the screen 
>>>> accordingly.  But when, for instance, I change the #title and 
>>>> #description of the field, the changes are changed in the arrary 
>>>> itself (I can see this by putting a dsm() after changing the data), 
>>>> but the values on the screen don't change.  I'm making similar 
>>>> changes to other forms within the same hook function (different 
>>>> case statements), and they all work fine.  I've cleared all my 
>>>> caches (Drupal and browser), but to no avail.  Can anyone tell me 
>>>> why my form data isn't changing?
>>>>
>>>> Thanks.
>>>>
>>>> Steve
>>>>
>
>
> -- 
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/support/attachments/20090622/6bbcfa0d/attachment.htm>


More information about the support mailing list