On my registration page i have a custom field where anonymous users don't have view and edit permission.
However without seeing this field, upon saving the registration page the user gets a drupal message: ' 'my custom field is required'.
I have found this behaviour only when the field is a boulean type with a single on/off widget.
As soon as i take a different field or make it a radio button/checkbox widget type the user can save the registration page without the message.
Additional info:
I could make the field 'not required' by unchecking the checkbox on the fieldsetting however i need the field to be required on the user-edit page.
Comment | File | Size | Author |
---|---|---|---|
#5 | Screen Shot 2016-08-21 at 12.17.53 PM.png | 75.9 KB | mariacha1 |
#1 | field_permissions-required_fields-2203077-1.patch | 1.25 KB | Leksat |
Comments
Comment #1
Leksat CreditAttribution: Leksat commentedI was able to reproduce this for the file/image fields also.
STR:
On a fresh D7 installation (Standard profile):
1. Create Text (Text field), Boolean (Single on/off checkbox), and Image (Image) fields.
2. For all newly created fields check "Required field" checkbox, and set custom permissions so only admin role has full access and other roles have no access.
3. Go to user/register page as anonymous user, and try to submit the form.
Result:
1. No error message for the Text field. As expected.
2. There are error messages for Boolean and Image fields.
Probably this issue should be addressed to the core queue, because both file_managed_file_validate() and options_field_widget_validate() do not check the #access property before validation.
However, it would be good to handle this case in the field_permissions module.
Attached patch sets #required property to FALSE for all field for elements with #access == FALSE.
I also updated the priority to Major, because this issue makes module unusable in some cases.
Comment #3
mariacha1 CreditAttribution: mariacha1 as a volunteer and at ThinkShout commentedFixed. Thanks!
Comment #4
mariacha1 CreditAttribution: mariacha1 as a volunteer and at ThinkShout commentedSeems to still be a problem with image fields in d8, although the checkbox problem looks solved:
Comment #5
mariacha1 CreditAttribution: mariacha1 as a volunteer and at ThinkShout commentedComment #6
AnybodyThank you for fixing this very important issue. Could you please create a new stable D7 release?
I think this is very important for all of us. The dev works great!