Eric’s adventures in Sharepoint, technology, and life.
Email icon Home icon
  • Removing HTML Person Group Fields in Sharepoint

    Posted on October 12th, 2009 Eric 2 comments

    Over on Stump the Panel, Sasha wanted to change the message being displayed on a Tasks list when no one had a task assigned. The hyperlinks for the Assigned To user on the DispForm and EditForm.aspx pages should also be removed.

    First, the Disp/Edit forms. In order to make changes to these pages, we need to employ the tool pane URL hacking method. You’ll need to have a tasks list populated with some data or you won’t be able to see this in action. Click on one of the items to go to the DispForm page. Employ the tool pane hack by appending &PageView=Shared&ToolPaneView=2 to the end of the URL in the address bar and hit Enter. Success, we’re in Edit mode.

    Add a content editor web part. Click the source editor button and paste in the following:

    
    
    

    Substitute a local path to jQuery if it exists in your environment. You may be thinking to yourself that this script looks familiar, well it should. It is the same script from the employee training admin page modifications only repurposed slightly. I have changed the selector to ms-formbody to isolate the HTML Assigned To field. This makes the hyperlink disappear.

    Next step, change DispForm to EditForm in the URL. Add a content editor web part to the page like before. Click the source editor and add the following into it:

    
    

    Now the underline will be gone from the people picker control.

    The original problem was solved by converting the view to an XSLT data view and entering in the default message to be displayed when no items were found. Then Sasha noted that the Assigned To name hyperlink should be removed. This again involved more recycled jQuery code. The XSLT Code for the Assigned To filed looks like this, note we added person as the selector:

    <td class="{$IDADW2OC} person">
    	<xsl:choose>
    		<xsl:when test="@AssignedTo=''"></xsl:when>
    	<xsl:otherwise><xsl:value-of select="@AssignedTo" disable-output-escaping="yes" /></xsl:otherwise>
    	</xsl:choose>
    </td>

    And the jQuery to remove the HTML:

    
    
    

    Post to Twitter Post to Plurk Plurk This Post Post to Yahoo Buzz Buzz This Post Post to Delicious Delicious Post to Digg Digg This Post Stumble This Post

     

    2 responses to “Removing HTML Person Group Fields in Sharepoint” RSS icon


    Leave a reply