Does it make sense to have the ability to set a default value for a field that is hidden from users? I am thinking it may be an interesting feature especially with fields that may be hidden from certain roles.

Comments

AndrzejG’s picture

Category:feature» bug

Changed category to "bug report".

Of course, setting default value for the field hidden in the form is absolutely necessary, for various use cases.

I have a content type, something similar to timeline. It can be created as any other node except that it should be "activated" in order to"work". Activation has to be made through editing "start date/time" field, and this update of the node triggers the Rule action making some further arrangements.
In order to make it work without confusing the User, we have to hide a "start date/time" field in the form, and expose this filed as editable field in the Views under an "Activation" tab. However, in my case, Rules first check if that field HAS a certain value. So, it is necessary to be able to set a default value to this field, and hide it in the form.

But making so is a cause of the crash:
CRASH: PHP segmentation violation in date_field_validate() called at [/sites/all/modules/date/date.field.inc:332], in date_field_validate() called at [/modules/field/field.attach.inc:198], in _field_invoke() called at [/modules/field/field.attach.inc:766], in field_attach_validate() called at [/modules/field/field.attach.inc:815], in field_attach_form_validate() called at [/includes/common.inc:7654], in entity_form_field_validate() called at [/modules/node/node.pages.inc:77], in node_form_validate() called at [/includes/form.inc:1430], in form_execute_handlers() called at [/includes/form.inc:1371], ..., in call_user_func_array() called at [/includes/menu.inc:503], in menu_execute_active_handler() called at [/index.php:21]

Please see also http://drupal.org/node/1382236.