Posts

Showing posts from June, 2011

Use XSLT to hide columns in SharePoint list forms

Image
In this post i will explain how XSLT can be used to hide the list columns in forms for users with insufficient previleges. After you open your site and the list in SharePoint designer, create custom forms for New, Edit and Display forms. Open each of the forms and select the column which should be shown based on user permissions. Expand the Conditional Formatting option on the ribbon and select Show Content. In the next screen click on Advanced. In the pop up that appears after that, search for the function called IfHasRights This function will determine whether the current user has the rights specified and will do the formatting accordingly, based on the result. The permission mask specified is determined as the sum of the permission masks for the permissions required. Below mentioned are the permission masks for the permissions. ViewListItems - 1 AddListItems - 2 EditListItems - 4 DeleteListItems - 8 ApproveItems - 16 OpenItems - 32 ViewVersions - 64 DeleteVersi

SharePoint list forms display HTML instead of rendering

Image
I have recently come across a problem where a custom list form i created using SharePoint designer was displaying the HTML directly instead of rendering it. As shown above the HTML for the Assigned To column value is not being rendered. To overcome this you just have to add a simple property to you XSLT. Select the HTML that is displayed and go to the code view. You will see the statement as <xsl:value-of select="@Assigned TO"></xsl:value-of> To this you have to add a parameter called display-output-escaping <xsl:value-of select="@Assigned TO" display-output-escaping="yes"></xsl:value-of> As you can see, this time the HTML is rendered properly.