Wednesday

Hide or disable a field in sharepoint Editform.aspx based on the role?

Open the site in SharePoint Designer
Open the Lists folder and find your list and open it
Open Editform.aspx (best practice is to create a new form page...)
Click the ListFormWebPart and then edit the Web Part propertites and Hide this web part.
Place the insertion point before existing web part and click Insert, SharePoint Controls, Custom List Form
Pick your list, content type and click Edit Item Form
(now you have an edit form that can be customized)

To control who can see part of a page you can use the SPSecurityTrimmedControl. It looks like this...


... stuff you only want users with the ManageWeb permission ...


A list of the values for the PermissionsString
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx

Display the source view of the page and find the table row for the field you want to hide.
Wrap everthing from
to

in the SPSecurityTrimmedControl (be careful with the capitalization!)

SharePoint:SPSecurityTrimmedControl runat="server" PermissionsString="ManageWeb"
SharePoint:SPSecurityTrimmedControl


Now for a bug... SharePoint Designer will show an error in the Design view pane:

"PriorityError Rendering Control - Unnamed2Type 'Microsoft.SharePoint.WebControls.FormField' does not have a public property named 'xat-id'."

Ignore this and save the page. Now go and edit one of the items as a full control user and again as another user.

At the End Right click on the List/Document Folder and select supporting files and enter the new page. So that it will point to this page.