[support] Help, please, with ['#collapsed'] = FALSE;

William Smith william.darren at gmail.com
Thu Jul 19 01:48:57 UTC 2007


Start with this .. change:

function myformalter_form_alter($form_id, &$form) {
   if ($form_id == 'edit-junk-node-form') {
     $form['attachments']['#collapsed'] = FALSE;
     $form['author']['#collapsed'] = FALSE;
   }
}

to:

function myformalter_form_alter($form_id, &$form) {
   print $form_id . "<br>";
   print "<pre>"; print_r($form); print "</pre>";

   if ($form_id == 'edit-junk-node-form') {
     $form['attachments']['#collapsed'] = FALSE;
     $form['author']['#collapsed'] = FALSE;
   }
}

When you go to the submission page, it wil spit out the form id.  Make sure
this matches "edit-junk-node-form" (I suspect it doesn't, form ids don't
usually start with 'edit').

If it does match, check the rest of the output and make sure 'attachments'
and 'author' are correct array indexes to be targeting.

William.

On 7/18/07, John Thomas <drupal.org-2007 at jt-socal.com> wrote:
>
> In Drupal 5.1, when creating a node type junk, I would like the Author
> and Attachments blocks to be expanded (i.e. ['#collapsed'] = FALSE;)
>
> Based on searching around drupal.org, I decided to create a module to
> achieve this.  Following is my code.  It does not seem to work, the
> attachments and author blocks are still collapsed.  Can you help?  Any
> suggestions so I can learn how to debug this myself?  I do have the
> devel module installed now.
>
> <?php
> // $Id:
>
> /**
>    * @file
>    * My module to modify forms.
>    *
>    * I create a module to modify forms to my liking.
>    */
>
>
> /**
>    * Implementation
>    */
>
> function myformalter_form_alter($form_id, &$form) {
>     if ($form_id == 'edit-junk-node-form') {
>       $form['attachments']['#collapsed'] = FALSE;
>       $form['author']['#collapsed'] = FALSE;
>     }
> }
>
> -- Sincerely, John Thomas
> --
> Sincerely,
> John Thomas
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20070718/a2cec8a8/attachment.htm 


More information about the support mailing list