form_alter and form_form_id_alter. The form are not the same.

View: New views
9 Messages — Rating Filter:   Alert me  

form_alter and form_form_id_alter. The form are not the same.

by Michel Morelli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi. I have a cck's node. I need to change the value of some fields when
the "add" form is created.
I know that I need to use hook_fom_alter() or hook_form_form_id_alter().
But now the question: why the output of a print_r($form) executed in the
hook_form_form_id_alter() function is not the same that I receive if I
exec the print_r() in the hook_form_alter() function. The first does not
contain the cck fields.

Is only a my installation problem or is normal ?

M.

--
Michel 'ZioBudda' Morelli                       michel@...
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net                         ICQ: 58351764  
http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ziodrupal.net        MSN: michel@...                  
                                                JABBER: michel@...

--
[ Drupal support list | http://lists.drupal.org/ ]

Re: form_alter and form_form_id_alter. The form are not the same.

by Victor Kane-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It's probably picking up on another form on the same page: filter with the form id

On Tue, Jul 7, 2009 at 5:58 AM, Michel Morelli <michel@...> wrote:
Hi. I have a cck's node. I need to change the value of some fields when the "add" form is created.
I know that I need to use hook_fom_alter() or hook_form_form_id_alter(). But now the question: why the output of a print_r($form) executed in the
hook_form_form_id_alter() function is not the same that I receive if I exec the print_r() in the hook_form_alter() function. The first does not contain the cck fields.

Is only a my installation problem or is normal ?

M.

--
Michel 'ZioBudda' Morelli                       michel@...
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net                         ICQ: 58351764  http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ziodrupal.net                        MSN: michel@...                                                                  JABBER: michel@...

--
[ Drupal support list | http://lists.drupal.org/ ]


--
[ Drupal support list | http://lists.drupal.org/ ]

Re: form_alter and form_form_id_alter. The form are not the same.

by Michel Morelli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Victor Kane ha scritto:
> It's probably picking up on another form on the same page: filter with
> the form id
Only one form and filtered too.

M.

--
Michel 'ZioBudda' Morelli                       michel@...
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net                         ICQ: 58351764  
http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ziodrupal.net        MSN: michel@...                  
                                                JABBER: michel@...

--
[ Drupal support list | http://lists.drupal.org/ ]

Re: form_alter and form_form_id_alter. The form are not the same.

by Gordon Heydon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

This is normal. It all depends on the order and wherevypu module is  
being called compared to cck.

Gordon



On 07/07/2009, at 6:58 PM, Michel Morelli <michel@...>  
wrote:

> Hi. I have a cck's node. I need to change the value of some fields  
> when the "add" form is created.
> I know that I need to use hook_fom_alter() or hook_form_form_id_alter
> (). But now the question: why the output of a print_r($form)  
> executed in the
> hook_form_form_id_alter() function is not the same that I receive if  
> I exec the print_r() in the hook_form_alter() function. The first  
> does not contain the cck fields.
>
> Is only a my installation problem or is normal ?
>
> M.
>
> --
> Michel 'ZioBudda' Morelli                        
> michel@...
> Consulenza sistemistica in ambito OpenSource.
> Sviluppo applicazioni web dinamiche (LAMP+Ajax)
> Telefono: 0200619074
> Telefono Cell: +39-3939890025 --  Fax: +39-0291390660
>
> http://www.ziobudda.net                         ICQ: 58351764  http://www.ziobuddalabs.it 
>                       Skype: zio_budda
> http://www.ziodrupal.net                   MSN:  
> michel@...                                            
> JABBER: michel@...
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
--
[ Drupal support list | http://lists.drupal.org/ ]

Re: form_alter and form_form_id_alter. The form are not the same.

by Michel Morelli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Gordon Heydon ha scritto:
> Hi
>
> This is normal. It all depends on the order and wherevypu module is
> being called compared to cck.
>
Ah, ok.Thanks.

Is there the possibility to know this order ?

M.

--
Michel 'ZioBudda' Morelli                       michel@...
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net                         ICQ: 58351764  
http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ziodrupal.net        MSN: michel@...                  
                                                JABBER: michel@...

--
[ Drupal support list | http://lists.drupal.org/ ]

Re: form_alter and form_form_id_alter. The form are not the same.

by Victor Kane-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What order? If he says there's only one form on the page???

On Tue, Jul 7, 2009 at 6:41 AM, Michel Morelli <michel@...> wrote:
Gordon Heydon ha scritto:

Hi

This is normal. It all depends on the order and wherevypu module is being called compared to cck.

Ah, ok.Thanks.

Is there the possibility to know this order ?


M.

--
Michel 'ZioBudda' Morelli                       michel@...
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net                         ICQ: 58351764  http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ziodrupal.net                        MSN: michel@...                                                                  JABBER: michel@...

--
[ Drupal support list | http://lists.drupal.org/ ]


--
[ Drupal support list | http://lists.drupal.org/ ]

Re: form_alter and form_form_id_alter. The form are not the same.

by Michel Morelli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Victor Kane ha scritto:
> What order? If he says there's only one form on the page???
You talk about "form", Gordon talk about "module".

M.

--
Michel 'ZioBudda' Morelli                       michel@...
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net                         ICQ: 58351764  
http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ziodrupal.net        MSN: michel@...                  
                                                JABBER: michel@...

--
[ Drupal support list | http://lists.drupal.org/ ]

Re: form_alter and form_form_id_alter. The form are not the same.

by Jamie Holly :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Set your module weight lower than CCK. CCK installs with the default
weight of 0, so setting your module to -1 or anything less will cause it
to load before CCK and the hooks to be executed before CCK:

http://drupal.org/node/110238

Jamie Holly
http://www.intoxination.net 
http://www.hollyit.net



Michel Morelli wrote:
> Victor Kane ha scritto:
> > What order? If he says there's only one form on the page???
> You talk about "form", Gordon talk about "module".
>
> M.
>
>  
--
[ Drupal support list | http://lists.drupal.org/ ]

Re: form_alter and form_form_id_alter. The form are not the same.

by Michel Morelli :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jamie Holly ha scritto:
> Set your module weight lower than CCK. CCK installs with the default
> weight of 0, so setting your module to -1 or anything less will cause
> it to load before CCK and the hooks to be executed before CCK:
>
> http://drupal.org/node/110238
Thanks for the link.

M.

--
Michel 'ZioBudda' Morelli                       michel@...
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 --  Fax: +39-0291390660

http://www.ziobudda.net                         ICQ: 58351764  
http://www.ziobuddalabs.it                      Skype: zio_budda
http://www.ziodrupal.net        MSN: michel@...                  
                                                JABBER: michel@...

--
[ Drupal support list | http://lists.drupal.org/ ]