I have 7 fields in a content type and the last field value, I am updating programmatically. So it should not be displayed when adding content to it. What should I do.

  • You can use computed field module to add last field. Nov 22, 2013 at 6:00
  • will it hides a field??? @Jayendra Kainthola
    – Chella
    Nov 22, 2013 at 6:02
  • Yes, It will hide the field and even you can add token value for calculation in computed field. Nov 22, 2013 at 6:06

5 Answers 5


The way I prefer is to use Computed Field module. Not only it creates a field that's not editable for users, it also takes care about hooks, cache, and lets you simply choose recalculation strategy (on save / on display). All you really need to care with it, is the very code that calculates field's value.


Hope this will help field_hidden

Field Hidden defines five hidden field types

text, long text integer, decimal, floating-point Hidden in forms Hidden fields are always rendered as elements in forms. enter image description here


Go and edit the node content type and in Field Settings change the Field Visibility and Permission. enter image description here

Just remove the edit permission to any role.


You can add a field in your form programmatically as follows :

function hook_form_alter($form,&$form_state, $form_id) {

 if ($form_id == 'your_form_id') {

$field_hidden_value = 'enter your computed value here' ;
   $form['field_hidden'] = array(
      '#type' => 'value',
      '#value' => $field_hidden_value,


If you are looking to avoid creating a custom module/using code:


  • Setup a new rule with the event: Begin [your form name] being built
  • Setup a new action: Rules Forms > Set an attribute of an element in the form
  • Set the attribute #access to false

The form element will now be hidden.

If you are trying to avoid creating a custom module, this does the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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