Custom node add/edit form - How to leave value of undisplayed field as set? I have a person node. There are some internal fields only the admin can change (e.g. Internal person code). Some other fields users with certain roles can change (e.g. first name...).

I have built a custom page using panels for this; I added the desired fields for normal users to the panel and Then I added a selection rule to the variant, enabling the variant for the normal users.

When a normal user opens the form and saves it, the internal fields, which only should be edited by the admin are set to NULL, because they were not submitted of course.

Is there any setting I missed? I don't want to add all the internal fields.

Thanks.
After some research I found out, that it is very important to have the full node form be added to the panel to get all fields (like publishing option, date created...), so the submit routine gets data for all node fields.

You can show/hide fields for certain roles using the Field Level Permission Module for the standard Drupal roles. But I like to use the OG roles to define the permissions. There is already an OG function for this under admin/config/group/permissions.

I did it this way:


Activate the node/%/edit page under pages
Create a variant for editing node of a certain type
Add all required fields, which should be shown to the normal user to the form and layout it
Add the submit buttons to the form
Add General Form to the panel, so that all fields, which are not build before are added to the form (like publishing status, author, date created...)
Goto admin/config/group/permissions and set the edit rights for the fields, the normal user should not see. The fields then are not on the node form anymore, but the values remain in the database.


I hope that helps someone else.