views:

20

answers:

1

is there any way to make a section invisible from template.php in drupal ?

Something like:

$form['name'] = array(
    '#visibility' => 'hidden',
...

thanks

+3  A: 

hook_form_alter is the standard way to change forms.

you can use '#access' => FALSE, if you wish to remove the item from the page. Or '#type' => 'hidden' to create a hidden form field. Drupal will not allow dynamic manipulation of a hidden fields (or at least one which has a value initally). If you want a hidden value which can be altered by a client side script try this:

$form['foo'] = array(
    '#type' => 'textfield',
    '#attributes'=>array('style'=>"display:none"),
    '#default_value' => $node->foo
  );
Jeremy French

related questions