17

is there a hotfix for problem with PeopleEditor in IE-9? http://social.msdn.microsoft.com/Forums/pl-PL/sharepoint2010general/thread/90b3835c-6754-4bb6-9fd4-b74f16f236ff

Exception Details: System.InvalidOperationException: Namespace prefix 'xsd' is not defined.

Solution is

<meta http-equiv="X-UA-Compatible" content="IE=8"/>

but we want to use

<meta http-equiv="X-UA-Compatible" content="IE=9"/>
1

4 Answers 4

19

Alex,

This really is one of the more vexing issues of upgrading the branding/master page of a SharePoint site. Please try this solution:

I created a javascript file called entityeditor.ie9fix.js, added the javascript code that will follow, and saved it in /layouts/1033.

In my master page I added

<script type="text/javascript" src="/_layouts/1033/entityeditor.ie9fix.js"></script>

to the very BOTTOM of the master page, right before the following tags:

<input type="text" name="__spDummyText1" style="display:none;" size="1"/>
<input type="text" name="__spDummyText2" style="display:none;" size="1"/>

For some reason using the usual tricks to get it to load after the original entityeditor.js from SharePoint did not work.

Inside the custom javascript is an override of a SharePoint function and a helper function:

function ConvertEntityToSpan(ctx, entity)
{ULSGjk:;
    if(matches[ctx]==null)
        matches[ctx]=new Array();
    var key=entity.getAttribute("Key");
    var displayText=entity.getAttribute("DisplayText");
    var isResolved=entity.getAttribute("IsResolved");
    var description=entity.getAttribute("Description");
    var style='ms-entity-unresolved';
    if(isResolved=='True')
        style='ms-entity-resolved';
    var spandata="<span id='span"+STSHtmlEncode(key)+"' isContentType='true' tabindex='-1' class='"+style+"' ";
    if (browseris.ie8standard)
        spandata+="onmouseover='this.contentEditable=false;' onmouseout='this.contentEditable=true;' contentEditable='true' ";
    else
        spandata+="contentEditable='false' ";
    spandata+="title='"+STSHtmlEncode(description)+"'>"
    spandata+="<div style='display:none;' id='divEntityData' ";
    spandata+="key='"+STSHtmlEncode(key)+"' displaytext='"+STSHtmlEncode(displayText)+"' isresolved='"+STSHtmlEncode(isResolved)+"' ";
    spandata+="description='"+STSHtmlEncode(description)+"'>";
    var multipleMatches=EntityEditor_SelectSingleNode(entity, "MultipleMatches");
    matches[ctx][key]=multipleMatches;
    var extraData=EntityEditor_SelectSingleNode(entity, "ExtraData");
    if(extraData)
    {
        var data;
        if(extraData.firstChild)
            data=extraData.firstChild.xml;
        if(!data) data=extraData.innerXml || extraData.innerHTML;
        if(!data && document.implementation && document.implementation.createDocument)
        {
            var serializer=new XMLSerializer();
            data=serializer.serializeToString(extraData.firstChild);

                    // **** CUSTOM FUNCTION ****
            data = fixDataInIE9(data);
        }
        if(!data) data='';
        spandata+="<div data='"+STSHtmlEncode(data)+"'></div>";
    }
    else
    {
        spandata+="<div data=''></div>";
    }
    spandata+="</div>";
    if(PreferContentEditableDiv(ctx))
    {
        if(browseris.safari)
        {
            spandata+="<span id='content' tabindex='-1' contenteditable='false'  onmousedown='onMouseDownRw(event);' onContextMenu='onContextMenuSpnRw(event,ctx);' >";
        }
        else
        {
            spandata+="<span id='content' tabindex='-1' contenteditable onmousedown='onMouseDownRw(event);' onContextMenu='onContextMenuSpnRw(event,ctx);' >";
        }
    }
    else
    {
        spandata+="<span id='content' tabindex='-1' contenteditable onmousedown='onMouseDownRw(event);' onContextMenu='onContextMenuSpnRw(event,ctx);' >";
    }
    if (browseris.ie8standard)
        spandata+="\r";
    if(displayText !='')
        spandata+=STSHtmlEncode(displayText);
    else
        spandata+=STSHtmlEncode(key);
    if (browseris.ie8standard)
        spandata+="\r</span></span>\r";
    else
        spandata+="</span></span>";
    return spandata;
}

// **** CUSTOM FUNCTION ****
function fixDataInIE9(data)
{
    if(data.indexOf('<ArrayOfDictionaryEntry>') >= 0)
    {
        data = data.replace('<ArrayOfDictionaryEntry>', '<ArrayOfDictionaryEntry xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema-instance\">');
    }
    return data;
}

After setting that up and publishing the master page I reloaded my site and had no problems saving people from the people picker. Heck of a lot easier than trying to get everyone to use firefox, or some kind of plugin.

PS: I marked my code with // ** CUSTOM FUNCTION **

/**** UPDATED 4/25/2012 ******/

Added reference to the exact location in which to place updated entityeditor.ie9fix.js script tag. Placing the script here will allow you to create new items and edit existing ones which contain a people picker control.

8
  • FYI, this apparently only works when you are creating NEW list items. If you are editing existing items in which the people picker is already filled in, there seems to be more work that needs to be done.
    – Matt
    Commented Apr 20, 2012 at 17:45
  • see update, issue resolved.
    – Matt
    Commented Apr 25, 2012 at 20:08
  • 1
    Thanks very much for this Matt. Came across the exact same problem on my site and your solution worked. Cheers!
    – user9462
    Commented Jul 13, 2012 at 13:29
  • Matt, Thank you for this great post and solution. You saved me hours of trying to debug and create a fix for this. Joe
    – user10410
    Commented Aug 29, 2012 at 19:02
  • 1
    Worked !!! thanks allot ...grrrr..hate microsoft!! they should have released such script...forcing IE-8 is not an option especially when html-5, css-3 don't work properly inside it. Commented May 11, 2015 at 6:45
5

This is my solution: http://blog.vitalyzhukov.ru/peopleeditorand-internet-explorer-9.aspx (in russian). Translated page by Google translator: http://translate.google.com/translate?sl=ru&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fblog.vitalyzhukov.ru%2Fpeopleeditorand-internet-explorer-9.aspx

1
  • Vitaly, this was extraordinarily helpful to me as I have been struggling with the same problem. I have come up with a slightly different solution, however, that I think maybe you will approve of.
    – Matt
    Commented Apr 17, 2012 at 18:52
1

The answer by Miracules is correct. I edited the pickerdialog.master file just a little differently -- Here's what I added in the head:

<head runat="server">
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE8"/>
<meta http-equiv="X-UA-Compatible" content="IE=8"/>

I continued to experience problems until I added 'runat=server' to the head tag.

Hope this helps!

1

You've got the solution right, but the location wrong. As the People Picker is using the pickerdialog.master file, you need to add the following line in the head element.

meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"

Find the pickerdialog.master file in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS and make a backup.

Now open it and insert the line at the start of the head element.

<head>
<meta name="GENERATOR" content="Microsoft SharePoint">;
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
....
</head>

This should solve the problem in People Picker.

Cheers

1
  • KCRyan: Good suggestion - I'll give it a try. (Also if you liked my suggestion, feel free to vote it up ;)
    – miracules
    Commented Aug 9, 2013 at 8:47

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