Posted by RoboPhred on May 20, 2008 at 12:49am
Jump to:
| Project: | Content Construction Kit (CCK) |
| Version: | 6.x-2.0-rc7 |
| Component: | General |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
I have a field that is required and has a default value set. Users do not have premission to edit it. Shouldn't the field get the default value in this case? Currently, it is remaining empty.
Comments
#1
what type of field? if a field does not appear on the form, then its requiredness should not be in effect.
please elaborate on how to reproduce this.
#2
I have the same issue in Drupal 5 (tested on a User Reference field).
See #254601: Cannot set and save the value of a read-only User Reference for detailed info. Hope this is still applicable in Drupal 6.
#3
I am making a simple feature request system for my projects. I have a feature request content type, which has a "status" cck field that can be viewed by anyone but only set by those with a certain premission.
The field is a selection list text field, set to required, and has a default value selected.
When a regular user creates a feature request, the field remains empty. I was expecting it to get the default value.
#4
The fact that the default value isn't working is a duplicate of http://drupal.org/node/224391. Can't tell if there's some other issue in here or not. Is that the only thing?
#5
I will look into that fix later on, but the issue is:
A content type has a cck field.
The cck field is only accessable to users of a certain role.
Users without the specified role can still create the content type.
Currently, the bug is: when a user creates a content type that contains a cck field they cannot modify, the cck field remains blank.
What I want to happen is: The cck field should recieve the default value when the user does not have premission to edit that cck field.
#6
This is more of a core FAPI issue than a CCK issue. CCK is just setting #access according to whether or not the user can access the widget. If FAPI is choosing not to pass along #default_value, then thats who should be yelled at (maybe - sometimes robophred's behavior doesn't make sense). Here is the relevant line from content_permissions_form_alter():
$form[$field_name]['#access'] = user_access('edit '. $field_name);Please reopen if CCK should be changed but I suspect either no change or core change is whats needed.
#7
Hi moshe,
I'm having the same issue with defaults values for fields not available in creation time form. I think it isn`t a FAPI issue but a "Default value definition" of CCK. When a read "Default Value" in CCK form content creation, I understand default value when no value was supplied ... I mean, if no value is supplied for this field, the default value will be the value saved to content table.
I think this is an important issue, because it gives to CCK more flexibility.
#8
#334945: Save default value when user has no permission to edit the field is more inline with the current state of the code and has a patch.