I created a choice field where a choice contains an ampersand, then added an item to the list and for the choice field I selected the one with the ampersand.

Now if I go to the display form of the item the ampersand appears html encoded (&). However it is displayed correctly as an ampersand on the new, edit forms as well as on the list view.

Is there some solution for this to show it properly on the display form also?

I tried it on 2 installations and the issue was present on both. Both using SharePoint 2013 Foundation, one on Windows Server 2008 R2 with SQL Server 2012, and the other on Windows Server 2012 with SQL Server 2012.

I have also tried creating the list in Visual Studio and just using the SharePoint UI, the result is the same for both approach.

PS: Cross posted on: http://social.technet.microsoft.com/Forums/sharepoint/en-US/620b39a5-f5f3-4d2c-8ed5-4b066b3d817e/ampersand-in-a-choice-of-a-choice-field-appears-html-encoded

1 Answer 1


On the Microsoft forums I got a suggestion to create a custom display form for the list. I don't really like that solution, so here is what I ended up doing:

I added a javascript file loaded to every page that overwrites the original Choice field rendering template for the DispForm. I realize that this is also not a great thing to do, but at least I only have to do it once.

The code in the file is:

// Fix for HTML encoded choice field value on display form
function registerChoiceFieldTemplateOverrides() {
    var choiceFieldContextOverride = {};
    choiceFieldContextOverride.Templates = {};
    choiceFieldContextOverride.Templates.Fields = {
        'Choice': {
            // The important bit: Change the display form template to the one that doesn't encode the value again. The original function that was used is: SPField_FormDisplay_Default
            'DisplayForm': window.SPField_FormDisplay_DefaultNoEncode,
ExecuteOrDelayUntilScriptLoaded(registerChoiceFieldTemplateOverrides, 'clientforms.js');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.