Custom field html displays as text

Advertisement
I am converting a custom field from a SharePoint 2007 version to SharePoint 2013. The field works correctly in SP2007. In SP2013 it has the correct information but displays as text instead of html. I have set the "disable-output-escaping" in the
xsl to "yes" but it does not help. Here the xml and xsl data for the field.
<?xml version="1.0" encoding="utf-8" ?>
<FieldTypes>
  <FieldType>
    <Field Name="TypeName">PriorityIndicator2</Field>
    <Field Name="ParentType">Text</Field>
    <Field Name="TypeDisplayName">Priority Indicator</Field>
    <Field Name="TypeShortDescription">Priority Indicator</Field>
    <Field Name="UserCreatable">TRUE</Field>
    <Field Name="Sortable">TRUE</Field>
    <Field Name="AllowBaseTypeRendering">TRUE</Field>
    <Field Name="Filterable">TRUE</Field>
    <Field Name="FieldTypeClass">Company.WebParts.PriorityIndicator2, $SharePoint.Project.AssemblyFullName$</Field>
    <Field Name="FieldEditorUserControl">/_controltemplates/15/PriorityIndicator2FieldEditor.ascx</Field>
    <Field Name="CAMLRendering">TRUE</Field> 
    <RenderPattern Name="DisplayPattern">
 <Column HTMLEncode="FALSE" />
    </RenderPattern>   
  </FieldType>
</FieldTypes>
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
                xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
                version="1.0"
                exclude-result-prefixes="xsl msxsl ddwrt"
                xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
                xmlns:asp="http://schemas.microsoft.com/ASPNET/20"
                xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                xmlns:SharePoint="Microsoft.SharePoint.WebControls"
                xmlns:ddwrt2="urn:frontpage:internal">
  <xsl:template match="FieldRef[@Name = 'PriorityIndicator2]" mode="Text_body">
    <xsl:param name="thisNode" select="." />
    <span style="background-color:lightgreen;font-weight:bold">
      <xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes" />
    </span>
  </xsl:template >
</xsl:stylesheet>
Any help would be greatly appreciated.
Luis R. Lebron
Advertisement

Replay

Hi,
According to your post, my understanding is that the custom field not render html well.
As you have known, we can use the “disable-output-escaping” to render the html, however, it not works in your environment.
As a workaround, we can use JQuery to render the html, I have made a simple code snippets to achieve this scenario, you can refer to it.
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
var theTDs = $("td[id='SPFieldCustom']");
//console.log(theTDs.html());
TDContent = theTDs.text();
//console.log(TDContent);
theTDs.html(TDContent);
</script>
Note: You should change the id to fit your environment.
Thanks,
Jason
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Jason Guo
TechNet Community Support