Beware of the ControlMode of SharePoint:FormField

My client has custom forms for a list in SharePoint 2010. Display/Edit/New all have customization. Within this customization there are your common SharePoint FormField and FieldDescription tags such as:

<SharePoint:FormField runat=“server” id=“ff2{$Pos}” ControlMode=“New” FieldName=“Title” __designer:bind=“ddwrt:DataBind(‘i’,concat(‘ff2′,$Pos),’Value’,’ValueChanged’,’ID’,ddwrt:EscapeDelims(string(@ID)),’@Title’)}”/>

<SharePoint:FieldDescription runat=“server” id=“ff2description{$Pos}” FieldName=“Title” ControlMode=“New”/>

Be aware of the “ControlMode“. This will be tied to your SPBasePermissions, which I’ve tried to override using the SPTrimmedControl block–which that does not work. Using the ControlMode=”Edit” will give users an access denied when trying to view using a user that only has Read permissions. In order to view ControlMode=”Edit”, the user needs to have Contribute permissions. Therefore, if the user has only Read permissions, the ControlMode must equal Display.

The context of the problem arose when I used the Edit ControlMode in the Display Form, and using jQuery to disable the textbox for just viewing. Sometimes the textboxes of the fields just look cleaner and are easier to read.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s