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.


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/], in date_field_validate() called at [/modules/field/], in _field_invoke() called at [/modules/field/], in field_attach_validate() called at [/modules/field/], in field_attach_form_validate() called at [/includes/], in entity_form_field_validate() called at [/modules/node/], in node_form_validate() called at [/includes/], in form_execute_handlers() called at [/includes/], ..., in call_user_func_array() called at [/includes/], in menu_execute_active_handler() called at [/index.php:21]

Please see also