[support] hook_form_alter() problems

Stefan Nagtegaal drupal-support at robuustdesign.nl
Fri Aug 10 08:07:28 UTC 2007


Hi list,

I'm having some difficulties with the hook_form_alter() usage (docs -  
http://api.drupal.org/api/function/hook_form_alter/5).
I made a custom module - which is for one site only - to improve the  
browsing/admin' experience for the new site admins on one of my  
websites.

In my example.module, I have the following code:

function example_form_alter($form_id, &$form) {
   //print $form_id;

   // Change the standard 'selectbox' to 'radiobuttons'
   if (($form_id == 'story_node_form') && ($form['taxonomy'])) {
     //print $form['taxonomy']['1']['#type'];
     $form['taxonomy']['1']['#type'] = 'radios';
     //print $form['taxonomy']['1']['#type'];
   }
}

Uncommenting both "print $form['taxonomy']['1']['#type'];" reveal  
that $form['taxonomy']['1']['#type'] was indeed set to use radio  
buttons instead of the normal dropdown select box.

Though, it does *not* renders it like radio buttons..


Has anyone an idea on why it isn't working? And how this could be fixed?

I'm using Drupal 5.2 for development of this particular domain atm.


Thank you for your time and help!




Stefan Nagtegaal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20070810/a666f738/attachment.htm 


More information about the support mailing list