I have had problem with my custom display form, where displaying the content of a multiple line text box field does not render the special characters (such as &, >, “) and line breaks properly. After Googling for a couple of hours, there were no solution to my problem. Many suggested using “disable-output-escaping” to fix the special character issue, and some suggested using select=”ddwrt:AutoNewLine(string(@Description))” to fix the line breaks issue. They cannot co-exist in the “xsl:value-of” tag because the AutoNewLine function will overwrite the special characters with their HTML encoding (see here).
Finally, I have worked out a solution to resolve both issues. Adding the following template (function) to your display form ASPX and calling it when display a multiple line text field. It replaces the new line character (n or
) with a
Add this function to your DispForm.aspx file:
Where your multiple line text is displaying, replace this:
Although it might be a bit of work to replace all the multi-line text fields with the template call, it will finally give you some peace of mind. I’d be happy to know if you have any better ideas to overcome all these hassles. 🙂