I have a content type with fields added from the core module and I want to hide some fields in the edit form, but not in the page node.

I've tried with

$form['my_field']['#access'] = FALSE; in my custom module, but that hides the field in the node page too. Is there any other way to hide the field only in edit form?

My approach was to wrap some fields into a two columns. Here's what I've tried:

     * Implements hook_form_alter().

    function my_module_form_alter (&$form, &$form_state, $form_id) {
         switch ($form_id) {

          case 'custom_node_form':

          $form['column_left'] = array(
          '#prefix' => '<div class="column-left">',
          '#suffix' => '</div>',

           $form['column_left']['custom_field'] = $form['custom_field'];
           $form['custom_field']['#access'] = FALSE;

Unfortunately it's disabling into the page node too. I'm using Display suite for the full content and I'm pretty much sure that the field is not hidden from there.

  • case 'content_type_form': is mising ?
    – pico34
    Commented Sep 11, 2013 at 15:01
  • hook_form_alter cannot hide it on the node page
    – pico34
    Commented Sep 11, 2013 at 15:03
  • I forgot to copy that line, but in my module is already created. I have some difficulties in stackexhange with copying the codes and with the color codes. :) Commented Sep 11, 2013 at 15:04
  • @pico34 Somehow it's hiding in the node page too. Let's say when I'm adding a new content, filling the title field and when I save the content, the title is missing in the node page. If I remove $form['column_left']['title_field'] = $form['title_field']; $form['title_field']['#access'] = FALSE; it's ok, but the whole approach is to wrap the fields in columns. Commented Sep 11, 2013 at 15:12
  • I guess this module can help you.
    – arpitr
    Commented Sep 11, 2013 at 15:23

3 Answers 3


Have you checked


Your field is probably hidden here.

Otherwise, hook_form_alter is only for form you are right

An other attribute is :

$form['my_field']['#disabled'] = TRUE;
  • I'm using Display suite and the field is not hidden from there. I have a textfield and $form['my_field']['#disabled'] = TRUE; is only disabling the input form. Anyway I've added more info in my thread. Commented Sep 11, 2013 at 14:56

If you simply want it not to show on your edit form, modify your theme css file

.element_class {
  display: none;
  • 3
    bad idea if field is confidential, disable css reveals it
    – pico34
    Commented Sep 11, 2013 at 14:37
  • 1
    Yes, that's right. Using CSS is not the right solution in this case. Commented Sep 11, 2013 at 15:01

Use hook_form_alter to set the disabled property TRUE for the form field:

$form['field_name']['#disabled'] = TRUE;

Please refer to: Is it possible to hide fields on node edit form?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.